I have the following checkbox on my site but it dosen't work, tried to solve it before but still having trouble.

this is the code from my first page

<P>Do you want to take pets with you?
<INPUT type=CHECKBOX name = "PETS" value = "Y">Yes<br>

This is the code from my second page

IF strPETS = "Y" THEN strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' " ELSE strSQLLOC = strSQLLOC

Please help!!!

I have the following checkbox on my site but it dosen't work, tried to solve it before but still having trouble.

this is the code from my first page

<P>Do you want to take pets with you?
<INPUT type=CHECKBOX name = "PETS" value = "Y">Yes<br>

This is the code from my second page

IF strPETS = "Y" THEN strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' " ELSE strSQLLOC = strSQLLOC

Please help!!!

You're not capturing the value from the HTML form's checkbox. If you have a form with a checkbox name "PETS" then in your ASP script, you have to use Response.Form("PETS") to capture the value "Y" - this is only if the method of the form is "POST" - anyways, try this:

<%
 
IF request.form("PETS") = "Y" THEN 
strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' " 
response.write("YOU CHECKED THE BOX")
ELSE 
strSQLLOC = strSQLLOC
response.write("BOX NOT CHECKED")
end if
 
%>

Actually, it's a string value, and so is everything send via an HTTP GET or POST.

It is up to you, the developer to cast the strings to explicit types.

You must assign the value of the posted form field to your variable, strpets.
Either that, or do this:

IF request.form("PETS") = "Y" THEN strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' "
This article has been dead for over six months. Start a new discussion instead.