View Full Version : Instantly Calculate checkbox values

01-14-2010, 08:21 PM
So I have a series of drop down boxes and check boxes with values that are populated from a record set from mysql. How can I have it so when a value is changed, a text boxs value is automatically updated. Anyone know any exsisting examples I can modify?

I am sure this will need some type of java code working with the PHP.

Here is kind of a wierd example of what I want to do:

Dropdown Box1:
Option 1 "Hat" Value "5.00"
Option 2 "Glove" Value "1.00"
Option 3 "Shirt" Value "2.00"

Dropdown Box2:
Option 1 "White" Value "1.00"
Option 2 "Red" Value "1.00"
Option 3 "Blue" Value "3.00"

Total: <Textbox Here>

So if someone selects Box1 Option1 and Box2 Option3 Instantly the textbox value will become 8.00

Anyone ever have experience with anything like this?

01-14-2010, 09:12 PM
JavaScript not Java...
That said, guess you realized you posted in the wrong section :)

In any case, here's an example that will help you achieve that: http://www.webdevelopersnotes.com/tips/html/getting_the_text_from_an_html_drop_down_selection_list.php3

Use that to get the selected dropdown values, add the values (still using JS) and then print them back to the screen (google "javascript set textbox value" or something like that).