Hi,
I am very new to coding websites (infact this in my first one)
I wrote this code for the website with a query to a postgreSQL database.
The queries works fine and are able to get data into my dropdown boxes. However I want to populate my second dropdown box according to the selection the user made in the first dropdown and so on with the rest of the dropdowns.
If someone could help me with the code I will need to do this I appresiate it very much.Code:<%@ Language=VBScript %> <!-- #include file="DB/adodbinc.asp" --> <%Response.expires=0%> <%response.buffer=true%> <% DIM SQLstr DIM arrprovince DIM arrcity DIM arrcountry DIM numcityRows DIM numprovinceRows DIM numcountryRows DIM i SQLstr = "SELECT DISTINCT country FROM hotspot WHERE country<>'Null' AND country<>'South Africa' AND country<>'Switzerland (CH)'" arrcountry = DB_Query(strConnection,SQLstr,dbrt_GetRowsArray) IF IsArray(arrcountry) THEN numcountryRows = Ubound(arrcountry,gr_rows) ELSE numcountryRows = -1 END IF SQLstr = "SELECT DISTINCT province FROM hotspot WHERE province<>'Null' AND province<>'N/A' AND province<>'Not Applicable'" arrprovince = DB_Query(strConnection,SQLstr,dbrt_GetRowsArray) IF IsArray(arrprovince) THEN numprovinceRows = Ubound(arrprovince,gr_rows) ELSE numprovinceRows = -1 END IF SQLstr = "SELECT DISTINCT city FROM hotspot WHERE city<>'Null' AND city<>'N/A' AND city<>'Not Applicable' AND city<>'?' AND city<>'0'" arrcity = DB_Query(strConnection,SQLstr,dbrt_GetRowsArray) IF IsArray(arrcity ) THEN numcityRows = Ubound(arrcity,gr_rows) ELSE numcityRows = -1 END IF %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Hotspot Finder</title> </head> <body style="font-size: 12pt"> <table> <tr> <td style="width: 265px; height: 1px"> <strong><span style="font-size: 14pt">Country</span></strong></td> <td style="width: 263px; height: 1px"> <span style="font-size: 14pt"> <strong>Province</strong></span></td> <td style="width: 456px; height: 1px"> <span style="font-size: 14pt"><strong>Town</strong></span></td> </tr> <tr> <td style="width: 265px; height: 21px"> <select id="Select3" style="width: 158px" onclick="return Select1_onclick()"> <%FOR i = 0 TO numcountryRows %> <option selected="selected"> <%=arrcountry(0,i)%> </option> <%NEXT%> </td> <td style="width: 263px; height: 21px"> <select id="Select1" style="width: 158px" onclick="return Select1_onclick()"> <%FOR i = 1 TO numprovinceRows %> <option selected="selected"> <%=arrprovince(0,i)%> </option> <%NEXT%> <option></option> </select></td> <td style="width: 456px; height: 21px"> <select id="Select2" style="width: 158px" onclick="return Select2_onclick()"> <%FOR i = 0 TO numcityRows%> <option selected="selected"> <%=arrcity(0,i)%> </option> <%NEXT%> <option></option> </select></td> </tr> <tr> <td style="width: 265px"> </td> <td style="width: 263px"> </td> <td style="width: 456px"> </td> </tr> </table> </body> </html>
Regards



Reply With Quote

Bookmarks