If you don't want the page to reload when sport is selected you need some javascript function to fill the second select box. Where does the data to the second select come from, is it a single table or a table for each sport?
This code has two drop down and the second is depending one the first:
Set rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT sport_id, sport, sel2_id, sel2 FROM tabeller ORDER BY sport_id, sel2" Set rs = Conn.Execute (SQL) %> <script language="javascript" type="text/javascript"> var arr = [ <% oldValg1 = "" do while not rs.EOF if Cstr(oldValg1) <> CStr(rs("sport_id")) then Response.write "['" & rs("sport_id") & "¤¤¤" & rs("sport") & "', [" & vbCrLf oldValg1 = rs("sport_id") end if Response.write "'" & rs("sel2_id") & "¤¤¤" & rs("sel2") & "'"
rs.Movenext
if not rs.EOF then endValg = false if CStr(oldValg1) <> CStr(rs("sport_id")) then Response.write "]]" endValg = true end if Response.write "," if endValg = true then response.write vbCrLf else Response.write "]]" end if loop rs.Close Set rs=Nothing %> ]; </script>
<script language="javascript" type="text/javascript"> function initSels(){ createOpts(document.getElementById('sport')); }
If you don’t want the javascript or don’t care if the page reloads when sport is selected you can fill the sport drop down and add an OnChange event that reload the pages to fill the second drop down depending of the selected sport.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.