Search Problem
5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 25, 2009 (RSS)
Here's the first problem. I made a search form and started to test it out. Almost everything worked fine. The problem I was running into was, if I searched "Single Family", every "single family" came up, but if I searched "Single Family" with say "2" bedrooms, all "Single Family" would come up w/ different bedrooms. I was having trouble syncing them up. Any thoughts on how to fix that? Do I need to put values in every label?
The second problem is, the biggest issue now, now every time I search it tells me that there are no records found. No matter what I search. I can just put "Single Family" and nothing shows up. Very strange. Here is my form. Any thoughts?
<form id="form1" name="form1" method="post" action="http://www.idsitepreview.com/listingList.php">
<table width="746" height="60" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#084d09">
<td width="124" height="38" valign="bottom"><div align="center" class="style2">Property Type:</div></td>
<td width="78" valign="bottom"><div align="center" class="style2">Bedrooms:</div></td>
<td width="205" valign="bottom"><div align="center" class="style2">Price: </div></td>
<td width="79" valign="bottom"><div align="center" class="style2">Bathrooms:</div></td>
<td valign="bottom"><div align="center" class="style2">Sort Order:</div></td>
<td valign="bottom"> </td>
</tr>
<tr>
<td align="center"><select name="property_type" id="property_type">
<option value="" selected="selected">Any</option>
<option value="Commecial">Commercial</option>
<option value="Farm">Farm</option>
<option value="Land">Land</option>
<option value="Lot">Lot</option>
<option value="Mfd/Mobile">MFD/Mobile</option>
<option value="Single Family">Single Family</option>
<option value="Multi-Family">Multi-Family</option>
</select></td>
<td align="center"><select name="bedrooms" id="bedrooms">
<option value="">Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></td>
<td align="center"><select name="price">
<option value="" selected="selected">Minimum </option>
<option value="">Any</option>
<option>$0</option>
<option>$50,000</option>
<option>$75,000</option>
<option>$100,000</option>
<option>$125,000</option>
<option>$150,000</option>
<option>$175,000</option>
<option>$200,000</option>
<option>$250,000</option>
<option>$500,000</option>
</select>
<select name="price">
<option value="" selected="selected">Maximum </option>
<option value="">Unlimited </option>
<option>$50,000</option>
<option>$75,000</option>
<option>$100,000</option>
<option>$125,000</option>
<option>$150,000</option>
<option>$175,000</option>
<option>$200,000</option>
<option>$250,000</option>
<option>$500,000</option>
<option>$1,000,000</option>
<option>$2,000,000</option>
</select></td>
<td align="center"><label>
<select name="bathrooms" id="bathrooms">
<option>Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</label></td>
<td width="180"><label>
<select name="sort" id="sort">
<option>Any</option>
<option value="price DESC">By Price (High to Low)</option>
<option value="price ASC">By Price (Low to High)</option>
<option value="bedrooms ASC">Beds (High to Low)</option>
<option value="bedrooms DESC">Beds (Low to High)</option>
<option value="bathrooms ASC">Bathrooms (High to Low)</option>
<option value="bathrooms DESC">Bathrooms (Low to High)</option>
</select>
</label></td>
<td width="80" align="center"><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>
Also, does that look like what I want to be putting for sort order? Any help is greatly appreciated before I pull my hair out.
John
The second problem is, the biggest issue now, now every time I search it tells me that there are no records found. No matter what I search. I can just put "Single Family" and nothing shows up. Very strange. Here is my form. Any thoughts?
<form id="form1" name="form1" method="post" action="http://www.idsitepreview.com/listingList.php">
<table width="746" height="60" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#084d09">
<td width="124" height="38" valign="bottom"><div align="center" class="style2">Property Type:</div></td>
<td width="78" valign="bottom"><div align="center" class="style2">Bedrooms:</div></td>
<td width="205" valign="bottom"><div align="center" class="style2">Price: </div></td>
<td width="79" valign="bottom"><div align="center" class="style2">Bathrooms:</div></td>
<td valign="bottom"><div align="center" class="style2">Sort Order:</div></td>
<td valign="bottom"> </td>
</tr>
<tr>
<td align="center"><select name="property_type" id="property_type">
<option value="" selected="selected">Any</option>
<option value="Commecial">Commercial</option>
<option value="Farm">Farm</option>
<option value="Land">Land</option>
<option value="Lot">Lot</option>
<option value="Mfd/Mobile">MFD/Mobile</option>
<option value="Single Family">Single Family</option>
<option value="Multi-Family">Multi-Family</option>
</select></td>
<td align="center"><select name="bedrooms" id="bedrooms">
<option value="">Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></td>
<td align="center"><select name="price">
<option value="" selected="selected">Minimum </option>
<option value="">Any</option>
<option>$0</option>
<option>$50,000</option>
<option>$75,000</option>
<option>$100,000</option>
<option>$125,000</option>
<option>$150,000</option>
<option>$175,000</option>
<option>$200,000</option>
<option>$250,000</option>
<option>$500,000</option>
</select>
<select name="price">
<option value="" selected="selected">Maximum </option>
<option value="">Unlimited </option>
<option>$50,000</option>
<option>$75,000</option>
<option>$100,000</option>
<option>$125,000</option>
<option>$150,000</option>
<option>$175,000</option>
<option>$200,000</option>
<option>$250,000</option>
<option>$500,000</option>
<option>$1,000,000</option>
<option>$2,000,000</option>
</select></td>
<td align="center"><label>
<select name="bathrooms" id="bathrooms">
<option>Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</label></td>
<td width="180"><label>
<select name="sort" id="sort">
<option>Any</option>
<option value="price DESC">By Price (High to Low)</option>
<option value="price ASC">By Price (Low to High)</option>
<option value="bedrooms ASC">Beds (High to Low)</option>
<option value="bedrooms DESC">Beds (Low to High)</option>
<option value="bathrooms ASC">Bathrooms (High to Low)</option>
<option value="bathrooms DESC">Bathrooms (Low to High)</option>
</select>
</label></td>
<td width="80" align="center"><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>
Also, does that look like what I want to be putting for sort order? Any help is greatly appreciated before I pull my hair out.
John
John C. Morris
Interdimensional Designs
www.covdesigns.com
Interdimensional Designs
www.covdesigns.com
Re: [blind2uriz] Search Problem
By Kenny - February 24, 2009
I'm not sure where you are going wrong, but here is a form you can use that works. Maybe you can figure out what you are missing from this:
Let me know if it isn't working for you.
Kenny
<form method=POST action="form.php">
<b><font face="Helvetica" color="#000066">Search Residential Property Listings</font></b></p>
<table border=0 cellspacing=3 cellpadding=3 id="table4">
<tr>
<td bgcolor="#FFFFFF">
<table border=0 cellspacing=3 cellpadding=3 id="table5">
<tr>
<td><font face="arial" size=2> Price </font></td>
<td>
<select name="price_min">
<option value="">Minimum</option>
<option value="">Any</option>
<option value="0">$0</option>
<option value="50000">$50,000</option>
<option value="75000">$75,000</option>
<option value="100000">$100,000</option>
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="175000">$175,000</option>
<option value="200000">$200,000</option>
<option value="250000">$250,000</option>
<option value="500000">$500,000</option>
</select>
<select name="price_max">
<option value="">Maximum</option>
<option value="">Unlimited</option>
<option value="50000">$50,000</option>
<option value="75000">$75,000</option>
<option value="100000">$100,000</option>
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="175000">$175,000</option>
<option value="200000">$200,000</option>
<option value="250000">$250,000</option>
<option value="500000">$500,000</option>
<option value="1000000">$1,000,000</option>
<option value="2000000">$2,000,000</option>
</select>
</td>
</tr>
<tr>
<td><font face="arial" size=2> Bedrooms </font></td>
<td>
<select name="bedrooms_min">
<option value="">Minimum</option>
<option value="">Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<select name="bedrooms_max">
<option value="">Maximum</option>
<option value="">Unlimited</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</td>
</tr>
<tr>
<td><font face="arial" size=2> Bathrooms </font></td>
<td>
<select name="bathrooms_min">
<option value="">Minimum</option>
<option value="">Any</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
<select name="bathrooms_max">
<option value="">Maximum</option>
<option value="">Unlimited</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</td>
</tr>
<tr>
<td><font size=2 face="arial"> Type </font></td>
<td>
<select name="property_type_keyword" size="1">
<option value="">Any</option>
<option value="Home">Home</option>
<option value="Condos">Condos</option>
<option value="Townhouse">Townhouse</option>
<option value="Apartments">Apartments</option>
<option value="Mobile Homes">Mobile Homes</option>
<option value="Lot">Lot</option>
<option value="Acreage">Acreage</option>
<option value="Duplex">Duplex</option>
<option value="Triplex">Triplex</option>
<option value="Farm or Ranch">Farm or Ranch</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
</table>
<p>
<div align=center>
<input type=submit name="search" value=" Search Listings ">
</div>
</td>
</tr>
</table>
</form>
Let me know if it isn't working for you.
Kenny
Re: [blind2uriz] Search Problem
By Dave - February 24, 2009
Hi John,
A couple more tips to help debug this.
Change your form from POST to GET: <form id="form1" name="form1" method="GET" action="http://www.idsitepreview.com/listingList.php">
This will make all the search criteria show up in the url where you can more easily see (and modify or test) what is being submitted. You can change it back later when it's working if you like.
Enter numeric searches as whole numbers without extra characters. For example, change this: <option>$100,000</option> to this: <option value="100000">$100,000</option> otherwise the numeric searches won't work properly.
Next, if you're passing sort order directly to mysql make sure you're escaping it or it could make the page insecure.
Try those changes and if you're still having troubles attach your viewer file and we can take a look.
Hope that helps!
A couple more tips to help debug this.
Change your form from POST to GET: <form id="form1" name="form1" method="GET" action="http://www.idsitepreview.com/listingList.php">
This will make all the search criteria show up in the url where you can more easily see (and modify or test) what is being submitted. You can change it back later when it's working if you like.
Enter numeric searches as whole numbers without extra characters. For example, change this: <option>$100,000</option> to this: <option value="100000">$100,000</option> otherwise the numeric searches won't work properly.
Next, if you're passing sort order directly to mysql make sure you're escaping it or it could make the page insecure.
Try those changes and if you're still having troubles attach your viewer file and we can take a look.
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Search Problem
Thanks for the form example sagentic, it works great!
Thanks for the reply Dave and your information as well, but I'm confused on what you mean about sorting. How do I escape it? I've never tried to sort anything, so I went to sorting in CMSBuilder and put in my field names and added DESC to each, then just typed the corresponding name in the sort order field in the form. Do I need to do anything extra in on either side? Thanks for all your help.
John
Thanks for the reply Dave and your information as well, but I'm confused on what you mean about sorting. How do I escape it? I've never tried to sort anything, so I went to sorting in CMSBuilder and put in my field names and added DESC to each, then just typed the corresponding name in the sort order field in the form. Do I need to do anything extra in on either side? Thanks for all your help.
John
John C. Morris
Interdimensional Designs
www.covdesigns.com
Interdimensional Designs
www.covdesigns.com
Re: [blind2uriz] Search Problem
By Dave - February 25, 2009
Hi John,
The viewers don't support specifying sort order through a form yet. Only hard coding it in the admin program or source of the viewer page. The only way to do it currently is with a little bit of custom code.
Once you have everything else working start a new thread about that and attach your viewer file if you can and I'll help you out with it.
The viewers don't support specifying sort order through a form yet. Only hard coding it in the admin program or source of the viewer page. The only way to do it currently is with a little bit of custom code.
Once you have everything else working start a new thread about that and attach your viewer file if you can and I'll help you out with it.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com