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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Got an odd problem that is probably

Status
Not open for further replies.

lewis33

Technical User
May 21, 2001
64
US
Got an odd problem that is probably more of an HTML isssue. Got some queries that search via two drop down lists. Everything is working correctly except for two types of the values in the drop down lists. After stareing at this for a while, I think I may have isolated the problem. In one of the drop down lists, I have a product "Diet Plus" that relates to a product code of "DP+". When the user selects that one.......it produces no results from the SQL Server data though I know the query is correct per the data.

Then, in the specialty drop down list, I have a few entries with that produce "The page cannot be displayed" errors. I noticed that all of these entries have the '&' or '+" in them like .......

option value=&quot;&quot; selected> -- Provider Specialty -- </option>
<option value=&quot;Vets & Others&quot;>Vets & others</option>

</select>


Any ideas on this topic? Appreciated for the rest of my breathing days. Thanks from Cleveland.
 
Does the query that you are using in the asp run in query analyser?
 
My guess is that your passing these values in the querystring. What is happening is that those characters are assumed to have already been URL encoded and so when your Request object goes to parse out the querystring and give you variables it unencodes them, causing your information to be changed.

Try printing out the variables from the querystring to see if this is the case. The characters that will get mis-unencoded will be: ? &amp; + % etc

You can solve this by encoding them before placing them in the value attribute of your options:
Code:
<option value=&quot;<%=Server.URLEncode(&quot;Vets & Others&quot;)%>&quot;>Vets & others</option>

You may want to double check me on that syntax, as I haven't used it in quiote a while.

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Good answer Tarwyn - I just gave a very similar one in the JavaScript forum....

lewis33 - please try to avoid posting in more than 1 forum, if your post is way off base in one forum, the members will redirect you to the correct forum to post...

Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Guys,
Thank you.

The URLencode idea fixed this problem re:

<option value=&quot;<%=Server.URLEncode(&quot;Vets & Others&quot;)%>&quot;>Vets & others</option>

Problem was we were doing some if... type validation and to check for invalid user-entered values in a text box in a separate part of the page. For some reason this caused the problems with all the drop down list values with a '+' or ampersand. Thanks again for the ideas- sorry about the multiple listings in the forums. I'm used to using the database ones the most and didn't think.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top