PDA

View Full Version : Add checkbox fields


majc
12-08-2005, 02:54 AM
Im making a website of a store to gain experience.
I want to sum the checked products and show the total price in the website.
The products have checkboxes in front of them, and the prices are in the database.
How can i do that?
Thanks in advance!

TheShaner
12-08-2005, 05:03 PM
Basically, you set up a form with the checkboxes. Have a button that says something like "Calculate" or whatever. Have the form submit to the same page you're on. In your ASP code, you check to see if Request.Form("checkbox") has a value. If it does, then assign that value to a variable, else assign a value of zero to the variable. You'd do this for each checkbox, add up all the variables storing the values from the checkboxes, and then display this result via ASP on your page somewhere.

-Shane

majc
12-10-2005, 11:14 PM
Thanks for your help.
I will try that.