Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing the values of checkboxes with same name

Status
Not open for further replies.

bladergames

Programmer
Jun 23, 2001
4
US
I have 4 checkboxes. I want to sum their values together
All I can get is the values listing out, not adding up!

If they check 1 and 3, I'm getting a IntCat value of 13, not 4!!!! I will be more than happy to explain more, but I think this one is easy.

Page 1
Type=CheckBox Name=Category value="1" Checked>Process
Type=CheckBox Name=Category value="2" Checked>Equipment Type=CheckBox Name=Category value="4" >&nbsp New Model
Type=CheckBox Name=Category value="8" >&nbsp Other

Page2
For J=1 to Request.QueryString("category").Count
IntCat = IntCat + Request.QueryString("category")(J)
Next

i want my intcat to sum the values. It gives me a 13, not 4. I thought this was how to add them up! Thanks!!!
 
Just change

"IntCat = IntCat + Request.QueryString("category")(J)"

to

"IntCat = IntCat + CInt(Request.QueryString("category")(J))"

Voila! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top