+ o - così, prendi spunto:
codice:
<%
Dim p
'apro connessione DB
opzione1=request.form("opzione1")
opzione2=request.form("opzione2")
sql="SELECT id,opzione1 FROM Tbl_opzione1 "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, connDB ,0,1
if not rs.eof then
p="<select name='opzione1' onchange='form_dati.submit()'>"
p=p&"<option value=''>seleziona ...</option>"
do while not rs.eof
p=p&"<option value='"&rs("id")&"'"
if opzione1<>"" then
if CInt(opzione1)=Cint(rs("id")) then
p=p&" selected"
end if
end if
p=p&">"&Trim(rs("opzione1"))&"</option>"
rs.movenext
loop
p=p&"</select>"
end if
rs.close()
Set rs=Nothing
if opzione1<>"" then
sql="SELECT id,opzione2 FROM Tbl_opzione2 WHERE Rif_opzione1="&opzione1
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, connDB ,0,1
if not rs.eof then
p=p&"<select name='opzione2' onchange='form_dati.submit()'>"
p=p&"<option value=''>seleziona ...</option>"
do while not rs.eof
p=p&"<option value='"&rs("id")&"'"
if opzione2<>"" then
if CInt(opzione2)=Cint(rs("id")) then
p=p&" selected"
end if
end if
p=p&">"&Trim(rs("opzione2"))&"</option>"
rs.movenext
loop
p=p&"</select>"
end if
rs.close()
Set rs=Nothing
end if
'chiudo connessione DB
%>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name='form_dati' METHOD='POST'>
<%=p%>
</form>
</body>
</html>