hello all,
I have a form with multiple chechboxes. Depending upon what the user chooses
I need to make a select from a database with 6 tables. I pass the results
from the form to the SQL statement up to the moment I need to put in a where
request.form>0 clause. The big issue is that the request form may look like
str1,str2,str3,str4 if the user selects them all.
Maybe u can help because I'm completely lost.
Here is the code:
------FORM------
<form action="processquery.asp" name="formfilter" Method="Post">
<table border="0" bordercolor="#0033CC" cellpadding="0" cellspacing="0"
width="100%">
<tr>
<td width="100%">Choose County
</td>
</tr>
<tr>
<td width="100%">
<input type="checkbox" name="Judet" value="Alba"> Alba
<input type="checkbox" name="Judet" value="Arges"> Arges
<input type="checkbox" name="Judet" value="Arad"> Arad
<input type="checkbox" name="Judet" value="Braila"> Braila
<input type="checkbox" name="Judet" value="Botosani"> Botosani
<input type="checkbox" name="Judet" value="Brasov"> Brasov
<input type="checkbox" name="Judet" value="Buzau"> Buzau
<input type="checkbox" name="Judet" value="Cluj"> Cluj
<input type="checkbox" name="Judet" value="Calarasi"> Calarasi
</td>
</tr>
<tr>
<td width="100%">Choose Culture
</td>
</tr>
<tr>
<td width="100%">
<input type="checkbox" name="Cultura" value="Sgrau"> Grau
<input type="checkbox" name="Cultura" value="Sporumb"> Porumb
<input type="checkbox" name="Cultura" value="Sfloare"> Floare
<input type="checkbox" name="Cultura" value="Srapita"> Rapita
<input type="checkbox" name="Cultura" value="Ssoia"> Soia
</td>
</tr>
<tr>
<td width="100%>Choose Source
</td>
</tr>
<tr>
<td width="100%">
<input type="checkbox" name="Sursa" value="Dir.Agricola"> Directia Agricola
<input type="checkbox" name="Sursa" value="Simpozion"> Simpozion
<input type="checkbox" name="Sursa" value="APIA"> APIA
<input type="checkbox" name="Sursa" value="Altele"> Altele
</td>
</tr>
<tr>
<td width="100%" align="center" valign="middle">
<br /><BR /><input type="reset" name="Reset" value="Reset"> <input
type="submit" name="Submit" value="Add Contact">
</form>
---------processquery.asp--------------
<%
dim strjudet,strcultura,strsursa
strjudet=request("Judet")
strjudet=Replace(strjudet, ",","','")
strjudet=Replace(strjudet, " ","")
strsursa=request("Sursa")
strsursa=Replace(strsursa, ",","','")
strsursa=Replace(strsursa, " ","")
strcultura=request("Cultura")
%>
<%
Set RS = Server.CreateObject("ADODB.Recordset")
RS.ActiveConnection = Conn
SQL = "SELECT * FROM Customer,Address,FarmDetails,InfoDetails WHERE Customer.
ID=Address.ID AND Customer.ID=FarmDetails.ID AND Customer.ID=InfoDetails.ID
AND Address.County IN ('"&strjudet&"') AND Source IN ('"&strsursa&"') AND
each Item in strcultura>0"????how do I go about that?
RS.Open SQL, Conn, 1, 3
If NOT (RS.BOF AND RS.EOF) Then%>
<% While (NOT RS.EOF)
%>
I thought about making strcultura an array and then do something like for each item in the array add an AND ArrayItem>0 to the sql string. I may be talking stupid here but I don't know much about arrays or how to correctly construct the SQL syntax for that
Thanks