spaces in data

  • Hi. It's taken me a couple of days to learn to populate a dropdown with a table and pass it to a search page. But the problem I have is the space between words, ie Audio Equipment, Card System. The item has a partner field that relates to the time between electrical testing, which doesn't get found.

    Here's my code

    Response.Write "<form action=""ddquery.asp"" method=""GET"">"

    Response.Write "<select name=""Stock""><option selected>--Select Item--"

    do While Not RS.EOF

    Response.Write "<option value=" & RS("Item") & ">"

    Response.Write RS.Fields("Item")

    rS.movenext

    loop

    I'm retesting at the moment, so here's the 'query' page.

    SearchText = Request.Querystring("Stock")

    response.write (SearchText)

    Thanks in advance.

    Jon

  • Not sure I'm clear on your problem. Is your problem in returning the query or populating the drop down with the correct values?

  • I can get the query to populate the dropdown, just not pass to the query page.

  • You are not properly delimiting your vlaue in the option so say the value is FLU SEASON it would appear in source as

    <OPTION VALUE=FLU SEASON>FLU SEASON

    and when passed it sends only FLU. To fix this make the following change:

    Response.Write "<option value=" & RS("Item") & ">"

    to

    Response.Write "<option value='" & RS("Item") & "'>"

    now it will source in html as

    <OPTION VALUE='FLU SEASON'>FLU SEASON

    And when parsed the beginning quote and end set it off. Finally when sent, the data is sent as FLU SEASON.

    Hope this helps.

  • Cheers mate, that bloody apostrophe gets me every time!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply