PDA

View Full Version : Help with form posting....



stussy
09-08-2007, 05:02 PM
Hi,

I want to populate a dropdown box from a postgreSQL database and then let the user select For example a Country, and then post on next page(test.asp) all the provinces in that specific country. The connection to the database is fine and queries work, just cant seem to get data im quering to print to the page.




<%@ 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
DIM country
DIM province
DIM city
DIM oRs



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>

</head>
<body>



<form method="post" action="test.asp">
Country : <select id="country" name="post1" >

<%FOR i = 0 TO numcountryRows %>

<%=arrcountry(0,i)%>

</select>






</body>
</html>



Thats the code that I have at this stage, can someone assist ?