2 dynamic drop down boxes from database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 2 dynamic drop down boxes from database

    I'm populting one box from a table called category.
    I want to create another box that would be populated subcatagories
    from the subcategory table based on the selection from category.

    This the code for the first drop down

    <form method="Post" action="add.asp" onsubmit="return
    status_checker()" name="search">
    <SELECT NAME="Category_ID" ONCHANGE=search.submit()>
    <%
    Dim MyConn, RS, SQLcmd
    Set MyConn=Server.CreateObject("ADODB.Connection")
    MyConn.Open "media"
    Set RS=Server.CreateObject("ADODB.RecordSet")
    SQLcmd = "SELECT * From Categories"
    RS.Open SQLcmd, MyConn,1
    do until rs.eof
    response.write "<option value=""" & rs("ID") & """>"
    response.write rs("Category")
    response.write "</option>"
    rs.movenext
    loop
    rs.close
    %>
    </select>

    This query should go into the second dropdown box.

    SQLcmd = "SELECT Subcategories.CategoryID, Subcategories.SubCategory
    FROM Subcategories WHERE (((Subcategories.CategoryID)=" &
    request("Category_ID") & "))"

    I also should be able to submit the selections to the add.asp page

    Thanks
    alexz Guest

  2. Similar Questions and Discussions

    1. Typing for Drop Down Boxes
      Basically you know when you have a drop down box and you type a letter the drop box automatically goes to an item beginning with that letter. But...
    2. dynamic drop downlists in an editable dynamic datagrid.
      How would we address a situation where we have to put dynamic drop downlists in an editable dynamic datagrid. So the scenario is to populate a...
    3. Drop down boxes in CFGrid using cfgridcolumn
      Hi, Has anyone had problems with drop down boxes displaying in cfgrid using cfgridcolumn as follows: <cfgridcolumn name="Location"...
    4. Populating Drop Down Boxes from a database
      We moved our wesite from a Box running Coldfusion 4.0 to a box running Coldfusion MX. We populate some drop down boxes with information from a...
    5. unwanted space from drop-down boxes and forms
      i've got two drop down boxes in seperate forms in one table but seperate table rows. when i view them in DWMX everything is fine. i have no "<br>"or...
  3. #2

    Default Re: 2 dynamic drop down boxes from database

    Here is one idea (refreshing the page) about that:

    ASP Design Tips - Dependent Listboxes
    [url]http://www.bullschmidt.com/devtip-dependentlistboxes.asp[/url]

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    [url]http://www.Bullschmidt.com[/url]
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139