Google Answers Logo
View Question
Q: ASP querystring ( Answered 5 out of 5 stars,   0 Comments )
Subject: ASP querystring
Category: Computers > Internet
Asked by: dbarod-ga
List Price: $2.00
Posted: 31 Jul 2002 14:25 PDT
Expires: 30 Aug 2002 14:25 PDT
Question ID: 47667
Using asp,  how do I pass space in querystring? Is there a
straightforward way without using java script?
Subject: Re: ASP querystring
Answered By: j_philipp-ga on 31 Jul 2002 14:48 PDT
Rated:5 out of 5 stars
Hello Dbarod,

You can use the "%20" or "+" character to pass a space in a
query-string. Or, if you pass the value using a form, you can simply
include the space-character.
See the following ASP (XHTML/ VBScript) sample, named "default.asp":

<p>You submitted "<% = request.queryString("test") %>"</p>

<p><a href="default.asp?test=Hello%20World">Test</a></p>

<form action="default.asp" method="get">
  <input type="text" name="test" id="test" value="Hello World" />
  <input type="submit" value="Submit" />

Hope that helps!

Request for Answer Clarification by dbarod-ga on 01 Aug 2002 06:08 PDT
I guess I should have made my question more detailed. I have a
character string "New Mexico" assigned to a variable "varwicagency". I
pass the variable using

<input type="hidden" name="wic" value=<%=varwicagency%>>

I have other identical code where this works just fine and blanks are
passed along with anything afterwards, but in this case the passed
string always comes out as .....&wic=New&..... so it it losing
everything after the blank.

Request for Answer Clarification by dbarod-ga on 01 Aug 2002 06:17 PDT
Verrrrry interesting. I unhid the field by changing it to a "text"
field and sure enough, only the "New" shows up in the box. So the
problem is before the passing.

I added the second name "Mexico" into the text field and the blank was
passed OK.

Clarification of Answer by j_philipp-ga on 01 Aug 2002 06:38 PDT
Hello Dbarod,

It's important to put quotes around the attribute value, so that it reads:
<input type="hidden" name="wic" value="<%=varwicagency%>"> 

Then the string will be passed along OK.

Hope that helps!
dbarod-ga rated this answer:5 out of 5 stars
I don't take 5 star for granted. This person zeroed right in on my
problem and helped a lot. Very fast turnaround on the follow up too. I
got two answered for the price of one.

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy