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

Drop down menu

Status
Not open for further replies.

smash81

Programmer
Mar 12, 2001
88
0
0
KE
Hello,
I have tried to get data from a database and then populate a drop down(select) box with the data.The menu is in a form which i am submitting and the action ASP displays the data selected from the menu.The problem is that the data displayed is only the first word of the selected data.
Example if "hello world" is selected, only hello gets displayed.
The code i have used for the select is
while not rs.eof
response.write &quot;<option value=&quot; & rs(0) & &quot;>&quot; & rs(0) & &quot;</option>&quot;
rs.movenext
wend

Please help me on how i can get the whole option selected.
Cheers
 
What actually comes out when the page is served, if you do view source from your browser?

Does the whole word appear between the option tags?
 
Try enclosing the option value in single quotes i.e.
Code:
response.write &quot;<option value='&quot; & rs(0) & &quot;'>&quot; & rs(0) & &quot;</option>&quot;
If that doesn't work, then try using server.URLEncode to encode the option value:
Code:
response.write &quot;<option value='&quot; & server.urlencode(rs(0)) & &quot;'>&quot; & rs(0) & &quot;</option>&quot;
HTH,

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top