I have 3 combobox, i want search function who really user friendly like if I choose "Hot deals" on 1st combobox then leave "ALL" for 2nd combobox and 3rd combobox, it's mean the result after press button submit will be "SELECT * from property where id_status='2'" ----or---- if I leave 1st combobox to be "All" and I choose "Seminyak" for 2nd combobox and choose "Land for sale" for 3rd combobox, it's mean the result will be "SELECT * from property where id_area='seminyak' and id_type='land for sale'" ---and etc.. whatever the user choose from 3 combobox"
here my code html
<form method="post" action="property-sortir.php">
<p>
<input type="hidden" name="id" value="<?php echo "$_GET[id]";?>">
Location : <b><?php echo "$location"; ?></b><br>
Category :
<select name="status">
<option value="0" selected >All</option>
<option value="1" style="color: blue;">New</option>
<option value="2" style="color: red;">Hot Deals</option>
<option value="3">Normal</option>
</select>
Area :
<select name="area">
<option value="0" selected >All</option>
<?php
$sql=mysql_query("select * from area where id_location=$_GET[id]");
while($r=mysql_fetch_array($sql)){
echo"<option value='$r[id_area]'>$r[nama_area]</option>";
}
?>
</select>
Types :
<select name="type">
<option value="0" selected>All</option>
<?php
$sql=mysql_query("select * from type where id_location=$_GET[id]");
while($r=mysql_fetch_array($sql)){
echo"<option value='$r[id_type]'>$r[nama_type]</option>";
}
?>
</select>
<button type="submit">Search</button>
</form>
and here the code of property-sortir.php
<?php
if ($_POST['id']==1){
$location="Bali";
}
else{
$location="NTT";
}
$status=$_POST['status'];
$area=$_POST['area'];
$type=$_POST['type'];
$property2 = mysql_query("select * from property where id_location='$_POST[id]' AND id_status='$_POST[status]' AND id_area='$_POST[area]' AND id_type='$_POST[type]' order by id_property DESC");
while($s=mysql_fetch_array($property2)){
<!--blablabla-->
}
?>
but the problem is, I can't display result flexible or just limited. help me please
