...

View Full Version : Form totals without having to submit form?



optimus203
01-18-2010, 01:00 AM
Hey everyone. I have a project I'd like to create, but need some help with (Note, I am a newbie with PHP).

I want to create a carbon footprint calculator as part of a school project. The equations will be created using PHP equations and a form for user input values.

I would like to know if (and how) the totals for the users input can be displayed on the screen, without the user having to submit the form. Thanks in advance for your help.

Len Whistler
01-18-2010, 01:11 AM
Hey everyone. I have a project I'd like to create, but need some help with (Note, I am a newbie with PHP).

I want to create a carbon footprint calculator as part of a school project. The equations will be created using PHP equations and a form for user input values.

I would like to know if (and how) the totals for the users input can be displayed on the screen, without the user having to submit the form. Thanks in advance for your help.

It would be best to use Javascript to get calculations without reloading the page.

http://www.codingforums.com/forumdisplay.php?f=2


------



-----------

optimus203
01-18-2010, 01:44 AM
Thats what I was thinking. Do you have a link to a particular thread that will help? Looking right now for a solution on the link you provided, but haven't been able to find the right thread yet. Thanks.

Len Whistler
01-18-2010, 01:48 AM
Here is an example:

http://www.javascriptkit.com/script/cut18.shtml




----------------

optimus203
01-18-2010, 01:56 AM
I'm trying to find something a little more complex, like this:
http://www.nature.org/initiatives/climatechange/calculator/

JAY6390
01-18-2010, 02:42 AM
If you're wanting it to work live, use a javascript calculator like Len has suggested. PHP requires a request to be sent to the server, so the only way that it can be run is to either reload the page with a form submission or send an AJAX request to the server instead, and is a little overkill for your needs since javascript alone can handle this



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum