problem of request form and query string

Discussion in 'C#' started by haan86, Nov 24, 2009.

  1. #1
    hi...
    i met a problem during request form and query string.
    When i select the data in select menu which are in 2 word, for example: "coffee shop", it only display "coffee" for me when return result. It only display 1 word for me.

    Anyone know what is the problem?

    Thanks you..


    below is my code:

    <form method="POST" action="gourment_state1.asp?start=1" name="GForm" onSubmit="return validatec()">
    
    <%              	
    Dim SearchText2, MyConn2, SQL2, SQL3, RS2
    Set MyConn2=Server.CreateObject("ADODB.Connection")
    MyConn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("../../db/abc.mdb") &
    SQL2 = "Select * From GType order by Title asc"
    
    Set RS2 = MyConn2.Execute (SQL2) 
    
    Response.Write "<select name=""GType"">"
    
    %>
    
    
    <%While Not RS2.EOF %>
    
    <%response.write" <option "  %>
    
    <%response.write "value=" &(RS2.Fields.Item("Title").Value) & " >"%>
    
    <%response.write (RS2.Fields.Item("Title").Value) %> 
    <%response.write "</option>"%>
    
    <% RS2.MoveNext
    Wend
    %>
    
    <%RS2.Close
    MyConn2.Close
    Set RS2 = Nothing
    Set MyConn2 = Nothing
    Response.Write "</select>"
    %>
    
     <input type="submit" name="Submit" value="Go">
      </form>
    
     <%response.Write(request.form("gtype"))%><%response.Write(request.QueryString("gtype"))%>
    
    Code (markup):
     
    haan86, Nov 24, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    I think that you need to surround the value in quotes in this line:
    <%response.write "value=" &(RS2.Fields.Item("Title").Value) & " >"%>
    you need to change it to:
    
    <%response.write "value='" &(RS2.Fields.Item("Title").Value) & "' >"%>
    
    Code (markup):
     
    camjohnson95, Nov 28, 2009 IP
  3. haan86

    haan86 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks you...
    it works... you helped me.. thanks :)
     
    haan86, Nov 29, 2009 IP