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

Variable loses part of its value 1

Status
Not open for further replies.

Chomauk

Programmer
Jun 8, 2001
130
1.) I'm getting a cookie value (i.e. John Smith) and storing it in a variable:
<%
Dim strName
strName = Request.Cookies(&quot;SavedLogin&quot;)(&quot;Name&quot;)
%>

2.) To prove I'm not crazy I verify the variable is what is should be and it is displayed correctly as &quot;John Smith&quot; using the following code:
<% Response.Write strName %>

3.) Here's where I'm am going crazy. The two below input statements show &quot;John&quot; but &quot;Smith&quot; is truncated:
<INPUT TYPE=&quot;Text&quot; Name=&quot;Name1&quot; Value=<% Response.Write strName%> >

<INPUT TYPE = &quot;text&quot; Name = &quot;Name2&quot; Value= <%=strName%>>

4.) If I hard-code something like:
<INPUT TYPE = &quot;text&quot; Name = &quot;Name2&quot; Value= &quot;John Smith&quot;>
It comes out correctly.

Why is the variable/INPUT truncating everything after the
first space is located??? How can I fix this???

Please help me. Thanks
 
Try
<INPUT TYPE = &quot;text&quot; Name = &quot;Name2&quot; Value= &quot;<%=strName%>&quot;>
Value should always be enclosed in double quotes but you get away with it if it does not contain special characters e.g. space.
 
Thank you very much, John, it worked!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top