Forum Moderators: coopster

Message Too Old, No Replies

PHP search help

         

MrFahad

9:18 pm on Nov 25, 2008 (gmt 0)

10+ Year Member



Hello, i want to make a drop down menu with options like (40,000$ to 60,000$) how can i do it and what will be the the MySQL statement to achieve such query

thank you :)

rob7591

2:35 am on Nov 26, 2008 (gmt 0)

10+ Year Member



You will need a select box with your options (I would use this format):
<select name="money">
<option value="40000-60000">$40,000 to $60,000</option>
</select>
Then in your search page:

<?
$a = explode('-', $_GET['money']);
$min = $a[0];
$max = $a[1];
$query = "SELECT * FROM table WHERE money >= $min AND money <= $max";
mysql_query($max);
?>

get it?

MrFahad

2:44 am on Nov 26, 2008 (gmt 0)

10+ Year Member



ya sure :) thanks for the help

Anyango

9:28 am on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Small Typo, rob7591


$query = "SELECT * FROM table WHERE money >= $min AND money <= $max";
mysql_query($max);

mysql_query($query)
not ($max) ;)

[edited by: Anyango at 9:28 am (utc) on Nov. 26, 2008]