I've got a real estate properties database that I want to search using the following form:
<form name="GWCsearch" method=GET action=searchform.php>
<select name=beds>
<option value="EFF">EFF</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>
<input type=text name=price size=8 maxlength=9><br><br>
<input type=submit name="submit" value="SEARCH">
<input type = checkbox name=chkType[] value="APT" CHECKED>Apartment<br>
<input type = checkbox name=chkType[] value="CONDO">Condo<br>
<input type = checkbox name=chkType[] value="HOUSE">House/Duplex
</form>
Now I want to search based on the user's selections by # of bedrooms, price, and type. I've tried to use "implode()" on the chkType[] array, but I get the following error:
Warning: implode(): Bad arguments. in /home/gowestca/public_html/searchform.php on line 117
Here is the php code starting with line 116:
mysql_select_db (gowestca_properties);
$sel_type = implode(', ', "$chkType");
$result = mysql_query("SELECT *
FROM properties
WHERE prop_beds = '$beds'
AND prop_price <= '$price'
AND prop_type IN ('$sel_type')
") //searches DB for matches
or die(mysql_error()); //just in case
Can anyone see what I'm doing wrong? Thanks.