View Full Version : filter database results as specified by drop down list on search page

08-02-2007, 06:58 PM
In Dreaweaver I cannot filter my database results to display only specific data that is retrieved from mulptile drop down list on my search page. The drop down list selections are posted to my display page by GET. How do i write my sql code so to only display info where TOWN = "Town selected from list" AND BEDS ="No of Beds selected from list

My search page consists of a form

<form action="tsearchresults.asp" method="get" name="townSearchForm" id="townSearchForm">

<select name="varBeds" id="varBeds">
<option value="%" >All</option>
<option value="1 Bedroom" >1 Bedroom</option>
<option value="2 Bedrooms" >2 Bedrooms</option>
<option value="3 Bedrooms" >3 Bedrooms</option>
<option value="4 Bedrooms" >4 Bedrooms</option>
<option value="5 Bedrooms" >5 Bedrooms</option>

<select name="varTown" id="varTown">
<option value="%">All</option>
<option value="Augher">Augher</option>

<option value="Coalisland">Coalisland</option>
<option value="Cookstown">Cookstown</option>
<option value="Donaghmore">Donaghmore</option>
<option value="Dromore">Dromore</option>


<input type="submit" name="Findhouse" id="Findhouse" value="Search" />


When the page tsearchresults.asp is displayed the url displays - http://localhost/tyrone/tsearchresults.asp?varBeds=%25&varTown=Augher&Findhouse=Search (http://localhost/tyrone/tsearchresults.asp?varBeds=%25&varTown=Augher&Findhouse=Search)
- hence just the fiter of town for town = Augher.
But all towns are displayed

I select Bindings and Recordset in dreamweaver on tserachresults page and in the advanced section -

I select all records from my table but cant figure out how to write my where statement to select the Town and Number of beds as passed from my search page

My variables, default values and Run time values are as below - am i refering correctly to my values from the form
varTown % Request.QueryString("Town")
varBeds % Request.QueryString("Beds")
where Town and Beds are records in my database.