After the user makes their selections and hits submit, you check to see if the form has been submitted, and then you check to see which checkboxes have been selected, and keep a tally of the total amount.
-
If Request.Form <> Empty Then ' if the form has been submitted and contains information
-
iTally = 0 ' Inialize a variable with a value of zero, so we can add to it.
-
If Request.Form("item1") = "on" Then ' if the checkbox "item1" has been checked by the user
-
iTally = iTally + 300
-
isCharge = true ' set a variable to see whether anything has been selected
-
End If
-
If Request.Form("item2") = "on" Then ' if the checkbox "item2" has been checked by the user
-
iTally = iTally + 400
-
isCharge = true
-
End If
-
'if items are being selected of monetary value, we need to add the laboratory charge to it, if they're not purchasing anything the iTally will return 0 and I'm *assuming* you don't want to add the laboratory charge in that case
-
If CBool(isCharge) = True Then
-
iTally = iTally + 500
-
End If
-
Response.Write "Your total charge is : " & FormatCurrency(iTally,2)
-
End If
-
Note that checkboxes return a value of "on" when they are checked, and DO NOT return any value when they are not checked.
Hope this helps.
Sincerely,
Mark