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

Adding Name to a text box

Status
Not open for further replies.

Gazosdeamigos

Programmer
Feb 19, 2004
10
GB
Hi im using asp with vb that is accessing a mdb and i was wondering how to add a name i.e. john doe to a text box this is the code i have so far
Response.Write "Name : <input name='name' type='text' value=" & rsData("name") & "><br>"
but it wont input the surname any help would be appreciated
 
The problem is with you rsData("name")...how are getting this variable??

-L
 
you may need to surround the value in single quotes, too:
Code:
<input name='name' type='text' value='" & rsData("name") & "'><br>"

or if you want your Response.Write to output double quotes inserting a "double" double-quote will escape the character:
Code:
<input name=""name"" type=""text"" value=""" & rsData("name") & """><br>"

Earnie Eng
 
So if you just have this:
Code:
Response.Write("<h3>|" & rsData("name") & "|</h3>")
what is displayed in nice, big letters between the pipes (|)?
 
joe bloggs

its just when i try to add it to a text box it shows as

joe
 
dont forget to HTMLEncode your value, otherwise characters in the value might cause issues with the page.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
I'm really surprised that Earnie's answers didn't work for you, then. Are you sure you're not looking at a cached version of the page?
 
some things to consider:
[ul][li]Are you sure that the name of the field in your database is "name"?[/li]
[li]is the "name" field in your DB a full name (both first and surname) or is there a seperate field for the surname?[/li]
[li]If it is indeed a full name and not split in to seperate fields for first/last, you may need to do some string manipulation to extract the surname from the full name...[/li][/ul]

Earnie Eng
 
yeah its a full name in one field, its not adding the surname to the text box think I need to do sume string manipulation. Its a problem with the space in between the forename and surname and the properties of a html text box
 
Yes, but that problem is solved by using Earnie's:
Code:
<input name=""name"" type=""text"" value=""" & rsData("name") & """><br>"
You can have as many spaces in the name as you want, because now it's surrounded by double-quotes. If you don't do that, then sure, the space will give you only the first name.

Are you sure you used that line of code and it didn't work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top