-
3 item calculator
I am trying to figure out a way to build a 3 item calculator. The way I see this set up is as follows:
Checkbox1 Checkbox2 Checkbox3
Total Displayed Here
I am trying to make something so when a check box is selected the price will display in an input box. If 2 items are selected, it will display the combined price and if 3 are selected it will do the same.
I know very little php, but was told it could be done.
Any help or ideas would be great!
Here is a link to a quick html page I put together.
http://www.settlementonehosting.com/...alculator.html
Thanks again!!
-
-
hey..
its difinatly possable.. but i think javascript would be a better option for u.. or a combination of both php and js..
-
-
PHP would require the page to be reloaded or the form sent. With javascript, it could respond immediately to the checkboxes.
for each checkbox... here's something you could try...
<input type="checkbox" value="3.88" onChange="if (this.checked == 1) { pricefield.value = pricefield.value+this.value; } else { pricefield.value = pricefield.value-this.value; }">
I believe that would suit your needs.
This would, by the way, require that the "results" field be called:
<input type="text" id="pricefield" name="pricefield">
Also, to avoid weird errors, it would require that each checkbox load unchecked, and the value of the pricefield start at 0.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks