hello,

i have two dropdown listboxes: one is for the countries, the other one's for the areas. in the 'countries' listbox, the user can select multiple values. what he selects, the second listbox is going to display the country's/-tries' corresponding areas. all entries should be fetched from the database.

ex. if the user selects u.k. and philippines from the countries listbox, the areas listbox will automatically display all areas from these two countries, i.e. take note, taken from the database. btw, i think it'll need javascript too. :eek:

i hope you got what i mean and could help me, once again :o , with this problem. i really need it very badly and ASAP. :cry:

thank u in advance! happy new year!! ;)

<html dir="rtl">
<head>
<script language="javascript">


function section_onchange()
{
DEPARTMENTS = document.form1.DEPARTMENTS.options[document.form1.DEPARTMENTS.selectedIndex].value;
window.location.href = "list.asp?DEPT_ID=" + DEPARTMENTS
}


</script>
</head>
<%
DEPT_ID= request("DEPT_ID")


%>
<form method="POST" name=form1>


<table dir=ltr>
<tr>
<td bgcolor="#E7EFF7" width="29%" class="bodytxt">
Depts</td>
<td bgcolor="#E7EFF7" width="69%" class="bodytxt">



<%'------------------------------------  This select to select DEPARTMENTS -------------------------------%><select size="4" name="DEPARTMENTS" class=bord3333 dir="rtl" onchange="return section_onchange();" multiple>
<option>-------------- CHOOSE DEPT----------------</option>
<%
Set Conn = server.createobject("adodb.connection")
Conn.open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=diwan;Data Source=10.35.12.20"
set rs1 = server.createobject("adodb.recordset")
sql = "select * from departments"
rs1.open sql,conn
if not rs1.eof then
while not rs1.eof
%>
<option value="<%=rs1("DEPT_ID")%>" <% if trim(DEPT_ID)= trim(rs1("DEPT_ID")) then %> selected <%end if%> >
<%=rs1("DEPT_NAME")%> </option>
<%
rs1.movenext
wend
rs1.close
set rs1 = nothing


'     RESPONSE.WRITE SQL
'response.end
end if
%>


</select>



</td>
</tr>



<%'------------------------------------  This select to select city by DEPARTMENTS Id -------------------------------%>
<% if DEPT_ID <> "" then%>
<tr>
<td bgcolor="#E7EFF7" width="29%" class="bodytxt">
Subjects</td>
<td bgcolor="#E7EFF7" width="69%" class="bodytxt">



<select size="1" name="city" dir="rtl" class=bord3333>


<%
Set Conn = server.createobject("adodb.connection")
Conn.open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=diwan;Data Source=10.35.12.20"
set rs = server.createobject("adodb.recordset")
sql = "select * from SUBJECT where DEPT_ID= " & DEPT_ID
'reponse.write sql
rs.open sql,conn
if not rs.eof then
while not rs.eof
%>
<option value="<%=rs("subject_id")%>" <% if trim(subject_desc)= trim(rs("subject_desc")) then %> selected <%end if%> >
<%=rs("subject_desc")%> </option>
<%
rs.movenext
wend
rs.close
set rs = nothing
end if
%>
</select>


<%end if%><%'------------------------------------------------- End City select  -----------------------------------------------------%>
</td>
</tr>
</table>
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.