asp and dropdown list with database

N

news

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
 
R

Ray Costanzo [MVP]

<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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top