Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, I'm making a website where you have to log in. It reads your information from a database and checks your password etc. When it has logged you in, you are taken to your account settings. Here you can specify if you want to change any details. You click the link, and it takes you to a page where your name, address (its an online shop) etc. are listed in textboxes using the code
<input type="text" name="txtSurname" value=<%=rs("Surname")%>>
where rs is the record set and Surname is the name of the field in the database. The problem is this works fine for one word fields, but if you want something with more than one word it wont show.
e.g. If your address is a string "47 Parkview Road" then only "47" will appear. If you check the variable that is being pulled out of the box and dispay it as html (albeit dynamic) then the full string "47 Parkview Road" is being pulled out. So it is definatley a problem with the text box.
Any solutions, if not anyone had the same problem and just found a way round it. Would love some help its one of those niggling little errors that really annoys you.
Thanks,
Adam

well, The only thing plausible that i can think of is that you would need to encode the form values before you sumit them to the database. This just makes the information into a more computer-friendly form. In javascript this can be done with the escape object: escape(variable) *or* escape(string)
Before you display the information again though, use the unescape object:
unescape(variable) *or* unescape(string).
Doing all of this encoding will turn normal strings and stuff into ASCii values. Most importantly, as your problems suggests, it will turn a space into a %20. hope this helped.-scott

The problem is simple - quotation marks (")
The solution is simple as well.
Either of these will solve the problem:
<input type="text" name="txtSurname" value="<%=rs("Surname")%>">
Or
<%
Response.Write "<input type=""text"" name=""txtSurname"" value=""" & rs("Surname") & """>
%>Hope this helps - Eitan

![]() |
How to show data in DataG...
|
Such a easy problem but s...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |