asp and dropdown list with database

Discussion in 'ASP General' started by news, May 3, 2005.

  1. news

    news Guest

    Hello,

    I need help with the following problem:



    An HTML page that have two dropdown list whit different values:

    1. Dropdown list 1(tblname1) =values with different location's. After user
    has selected one value from the dropdown it should show values from
    (tblname2) in the dropdown list2.

    2. When user select an value from dropdown list2(tblname2) and click on a
    button "GO" it should show all the value's from the database that been
    selected in dropdown list1 and 2.



    Please someone please help me out with this problem!?



    Regards,

    Kenneth
    news, May 3, 2005
    #1
    1. Advertising

  2. <select
    onchange="location.href='<%=Request.ServerVariables("SCRIPT_NAME")%>?id='+th
    is.value;">
    <% '' your code that puts in options %>
    </select>

    <%

    iSelectedID = Request.Querystring("id")
    If Not iSelectedID = "" Then
    ''your code to get other values for second box
    sSQL = "SELECT stuff FROM table2 WHERE foreignkey=" & iSelectedID
    End If
    %>
    <select>
    <% 'your code that loops through that second recordset if it was populated
    %>

    For more detailed examples, see here:
    http://www.aspfaq.com/show.asp?id=2270

    Ray at work


    "news" <> wrote in message
    news:OE8Rdo$...
    > Hello,
    >
    > I need help with the following problem:
    >
    >
    >
    > An HTML page that have two dropdown list whit different values:
    >
    > 1. Dropdown list 1(tblname1) =values with different location's. After user
    > has selected one value from the dropdown it should show values from
    > (tblname2) in the dropdown list2.
    >
    > 2. When user select an value from dropdown list2(tblname2) and click on a
    > button "GO" it should show all the value's from the database that been
    > selected in dropdown list1 and 2.
    >
    >
    >
    > Please someone please help me out with this problem!?
    >
    >
    >
    > Regards,
    >
    > Kenneth
    >
    >
    Ray Costanzo [MVP], May 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWVyZGFhZA==?=

    How to populate dropdown list from database?

    =?Utf-8?B?TWVyZGFhZA==?=, Oct 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,377
    =?Utf-8?B?TWVyZGFhZA==?=
    Oct 20, 2004
  2. vishnu
    Replies:
    1
    Views:
    1,191
    Patrick.O.Ige
    Mar 25, 2006
  3. =?Utf-8?B?RGF2ZSBU?=

    Columns in Dropdown list and list box

    =?Utf-8?B?RGF2ZSBU?=, Jun 25, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    497
    jufemaiz: jc
    Jun 27, 2007
  4. Replies:
    2
    Views:
    430
  5. djharrison

    dropdown list and database connection

    djharrison, Sep 25, 2003, in forum: ASP General
    Replies:
    1
    Views:
    141
    Ken Schaefer
    Sep 25, 2003
Loading...

Share This Page