ASP , javascript , SQl, and two dropdown lists?

justno1

New member
Hey, i have two dropdown lists, first one for the country lets say, and the sceond for the cities ... the 2nd dropdown list depends on the choice of the first ,, for example if USA is selected, the 2nd dropwdown list shows the states of USA. both lists are database driven.

The first dropdownlist for ex: (nevermind for the Connect and Opentb, they are just pre built functions).

<select style="width:344px" size="1" name="D3">
<%SQL = "select * from Regions"
set cn = Connect (Server.MapPath("Property.mdb"))
set rs = openTb(SQL,cn)%>

<%while not rs.eof%>
<option value="<%=rs(RegionID)%>"><%=rs(Region_Name)%></option>
<%rs.movenext%>
<%wend%>

<%set rs = nothing
set cn = nothing%>
</select>

and onchange of this dropdownlist comes the 2nd one which includes


<select style="width:344px" size="1" name="D4">
<%SQL = "select * from Location where (RegionID = here i want to put the value of the first dropdown)"
set cn = Connect (Server.MapPath("Property.mdb"))
set rs = openTb(SQL,cn)%>

<%while not rs.eof%>
<option value="<%=rs(RegionID)%>"><%=rs(Region_Name)%></option>
<%rs.movenext%>
<%wend%>

<%set rs = nothing
set cn = nothing%>
</select>


My whole problem is with sql statement: SQL = "select * from Location where (RegionID = here i want to put the value of the first dropdown)"

now i can get the value of the dropdown id by javascript using document.getElementByID().value .. but how can i insert it into the asp code where i put my sql statement .
I tried almost everything that has to do with concatenations and none worked,
any suggestions for how to fix this please?
Thanks
 
Back
Top