Results 1 to 3 of 3

Thread: Dropdown box!!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Question

    Hi,
    I am VERY,VERY new to asp-ado and need some help please.

    I want to put a dropdown box on my page with all the different countries as options. The user can then choose the country he wants to view and I want to then
    select * from table where country = "the country the user picked from the dropdown"

    My problem is how to get whatever the user selected into a variable which I can then use in my sql query

    Thank you,

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Canada
    Posts
    264
    you will have to use two pages:

    1. with a regular HTML extention that will have a form:

    <html>
    <head><title>My Country</title></head>
    <body>
    <form method="post" action="showinfo.asp">
    Please choose the country:
    <select name="thecoutry">
    <option value="A">A</option>
    <option value="B">B</option>
    <option value="C">C</option>
    </select>
    <input type="submit" value="go">
    </form>
    </body>
    </html>

    2.

    The ASP page (showinfo.asp)

    <%
    dim CountryName

    CountryName=trim (request.form ("thecountry")) ' this will get the name of the country the user choosed on the previous page

    strSQL = "set rowcount 0 select country from CountryTable where country=" & CountryName

    ....
    %>

    Hope it helped..

    In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.

    - Douglas Adams
    The Hitchhiker's Guide to the Galaxy

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    It depends.. Where do you need the data from the query to be displayed? If you need it on the same page, you can setup an event for the select tag that reloads the page passing the value of the select with a querystring back to itself. In the beginning code of the page, check for the existence of the querystring and use it in the query.

    If you need it in another page, add a submit button and set the action attribute to the new page and a method=post in the FORM tag. Make sure you use the name attribute in your select tag or you won't be able to get the data out of the Form collection.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

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



Click Here to Expand Forum to Full Width