My search page form is below
Expand|Select|Wrap|Line Numbers
- <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>
- <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>
- </select>
- <input type="submit" name="Findhouse" id="Findhouse" value="Search" />
- </form>
- 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.
The asp code for this is below
Expand|Select|Wrap|Line Numbers
- <%
- Dim Recordset1__varBeds
- Recordset1__varBeds = "%"
- If (Request.QueryString("Beds") <> "") Then
- Recordset1__varBeds = Request.QueryString("Beds")
- End If
- %>
- <%
- Dim Recordset1__varTown
- Recordset1__varTown = "%"
- If (Request.QueryString("Town") <> "") Then
- Recordset1__varTown = Request.QueryString("Town")
- End If
- %>
- <%
- Dim Recordset1
- Dim Recordset1_numRows
- Set Recordset1 = Server.CreateObject("ADODB.Recordset")
- Recordset1.ActiveConnection = MM_connTyrone_STRING
- Recordset1.Source = "SELECT DateAvailable, Address, Town, Postcode, Description1, Let, PropertyType, Beds, Price, ID, DatePosted, Description2 FROM HouseDetails WHERE Beds like '" + Replace(Recordset1__varBeds, "'", "''") + "' AND Town like '" + Replace(Recordset1__varTown, "'", "''") + "'"
- Recordset1.CursorType = 0
- Recordset1.CursorLocation = 2
- Recordset1.LockType = 1
- Recordset1.Open()
- Recordset1_numRows = 0
- %>
- While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
- <%=(Recordset1.Fields.Item("Beds").Value)%> <%=(Recordset1.Fields.Item("Town").Value)%>
- <td valign="top" class="PropertyHeading"><%=(Recordset1.Fields.Item("Address").Value)%>
All values are displayed and not just search results
Any Help would be VERY MUCH APPRECIATED