string not working

Reply

Join Date: May 2004
Posts: 4
Reputation: squirrelj is an unknown quantity at this point 
Solved Threads: 0
squirrelj squirrelj is offline Offline
Newbie Poster

string not working

 
0
  #1
May 21st, 2004
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!!!
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 1,135
Reputation: samaru is just really nice samaru is just really nice samaru is just really nice samaru is just really nice 
Solved Threads: 6
Team Colleague
samaru's Avatar
samaru samaru is offline Offline
a.k.a inscissor

Re: string not working

 
0
  #2
May 24th, 2004
Originally Posted by squirrelj
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:

  1. <%
  2.  
  3. IF request.form("PETS") = "Y" THEN
  4. strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' "
  5. response.write("YOU CHECKED THE BOX")
  6. ELSE
  7. strSQLLOC = strSQLLOC
  8. response.write("BOX NOT CHECKED")
  9. end if
  10.  
  11. %>
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 27
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: string not working

 
0
  #3
May 24th, 2004
Is a checkbox really sending a string value or is it not a boolen value?
Assistant Manager, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 32
Reputation: RobUK is an unknown quantity at this point 
Solved Threads: 1
RobUK RobUK is offline Offline
Light Poster

Re: string not working

 
0
  #4
Jul 13th, 2004
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:
  1. IF request.form("PETS") = "Y" THEN strSQLLOC = strSQLLOC & " AND fldPETS = 'Y' "
Rob - DMOZ Editor
Web Design Forums - Free website critiques. Web design + SEO Advice
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC