<?
if (0-200000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '0' AND '200000'";
}
else if (200001-400000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '200001' AND '400000'";
}
else if (400001-600000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '400001' AND '600000'";
}
else if (600001-800000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '600001' AND '800000'";
}
else if (800001-1000000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '800001' AND '1000000'";
}
else if (1000001-1500000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '1000001' AND '1500000'";
}
else if (1500001-2000000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '1500001' AND '2000000'";
}
else if (1500001-2000000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '1500001' AND '2000000'";
}
else if (2000001-10000000)
{
$sql="SELECT * FROM car WHERE price BETWEEN '1500001' AND '2000000'";
}
else
{
$sql="SELECT * FROM car WHERE price BETWEEN '0' AND '100000000'";
}
?>
<div class="container">
<div class="form-actions">
<form action="?Act=Between" method="post">
ราคา
<select name="selPrice">
<option value='All'>ทุกราคา</option>
<option value='200000'>น้อยกว่า 2 แสน</option>
<option value='400000'>2 แสน ถึง 4 แสน</option>
<option value='600000'>4 แสน ถึง 6 แสน</option>
<option value='800000'>6 แสน ถึง 8 แสน</option>
<option value='1000000'>8 แสน ถึง 1 ล้าน</option>
<option value='1500000'>1 ล้าน ถึง 1.5 ล้าน</option>
<option value='2000000'>1.5 ล้าน ถึง 2 ล้าน</option>
<option value='2000001'>มากกว่า 2 ล้าน</option>
</select>
<input type="submit" value="ค้นหา">
</form>
</div>
</div>
<?
$Act=$_GET['Act'];
switch($Act){
case 'Between' : $Price=$_POST['Price'];
if($Price == 'All'){
$sql="SELECT * FROM car WHERE price";
}else if($Price <= 200000){
$sql="SELECT * FROM car WHERE price BETWEEN '0' AND '199999'";
}else if($Price <= 400000){
$sql="SELECT * FROM car WHERE price BETWEEN '200000' AND '400000'";
}else if($Price <= 600000){
$sql="SELECT * FROM car WHERE price BETWEEN '400001' AND '600000'";
}else if($Price <= 800000){
$sql="SELECT * FROM car WHERE price BETWEEN '600001' AND '800000'";
}else if($Price <= 1000000){
$sql="SELECT * FROM car WHERE price BETWEEN '800001' AND '1000000'";
}else if($Price <= 1500000){
$sql="SELECT * FROM car WHERE price BETWEEN '1000001' AND '1500000'";
}else if($Price <= 2000000){
$sql="SELECT * FROM car WHERE price BETWEEN '1500001' AND '2000000'";
}else if($Price > 2000000){
$sql="SELECT * FROM car WHERE price BETWEEN '2000000' AND '1000000'";
}
}
?>