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

Passing a string (with spaces) in a form method post

Status
Not open for further replies.

pistolpinoy72

Technical User
Jul 31, 2003
10
PH
Please help...I wanted to pass a string (with spaces) in a form of an asp based on an input text. Method i used is "post".

Whenever i inputted a variable with spaces between, only the first word (before the space) was received by request.form from another asp. Say i entered "My Name" in a form with post method, the receiving asp will received it as "My" only (i used response.form).

Thanks.
 
make sure you use " in the <input>:

<input type=text name=field1 value="<%= rs("field1") ">

server.HTMLencode() can help you when you use spaces in URL's



ttmug.gif
 
I did it just like that but the problem still persist. By the ways, you mentioned "server.htmlencode()", just what does it do.

Thanks anyways.
 
Foxbox's advice should work. You might post your code to show what you are using and then it may be easier to track the problem from there.

For help with server.HTMLEncode, see this link

Just as a thought (and with respect to foxbox, to correct a small error), here is how your code should look:
Code:
<input type="text" name="field1" value="<%=request.form("otherField")%>">
If you do not enclose the value in quotes, then it will only pick up the value prior to the first space it encounters. The quotes allow it to pick up the entire value.

-----------------------------------------------------------------------------------------------------
&quot;If you can't explain something to a six-year-old, you really don't understand it yourself.&quot;
-- Albert Einstein
 
Oeps! that line was not complete indeed.
Code:
<input type=text name=field1 value="<%= rs("field1") [b]%>[/b]">



ttmug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top