SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Classic ASP Select Menu

    Hi there,

    I been trying work something out but with no luck, it's prob a simple thing and just having one of those days.

    What im doing is selecting countries from a mbd table

    Here's my code.

    Code:
    <select name="country" size="1" class="defaultSelect">
    <option value=""></option>
    <%
    Do While Not RS.EOF
       strCountry ="" & RS("country") & ""
              Response.Write "<option value='" & strCountry & "'>" & strCountry & "</option>"
    RS.movenext
    Loop
    %>
    </select>
    What needs to happen is, a user will have a country assigned to them I need to have their country selected in the select option. Information about each user will be within another table.

    table name for countrys = country
    table name for userInfo = contacts

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Buddy

    write the code like this


    <select name="country" size="1" class="defaultSelect">
    <option value=""></option>
    <%
    'take a variable called User_country and assigned the User assigned Country
    User_country = put the value of user assigned country
    Do While Not RS.EOF
    strCountry ="" & RS("country") & ""
    Response.Write "<option value='" & strCountry & "' >"
    if User_country= strCountry then Response.Write "selected"
    Response.Write " &'" strCountry & "</option>"
    RS.movenext
    Loop
    %>
    </select>

    Try this one and let me know


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •