-
passing value range via form post
HI
I want to pass a price range from one page to another via a form post, and then filter some mysql db records based upon this range.
I can pass a single value and filter everything upto this value but what I really want is to filter on a min-max range of values. Here's what I have so far:
input page:
<form action="propertylist.php" method="post" name="frm_forsale" id="frm_forsale">
<p><a href="propertylist.php?offeredfor=1">
<p>what is your price range? </p>
<p>
<select name="priceband" id="priceband">
<option value="250000">up to £250,000</option>
<option value="500000">£250K to £500K</option>
<option value="500001">over £500,000</option>
</select>
<input type="submit" name="go" value="Go" />
</p>
</form>
target page:
mysql_select_db($database_estateagent, $estateagent);
switch($colname_rs_property)
{
case "250000";
$query_rs_property = "SELECT * FROM propertydata WHERE price < 249999 ORDER BY price ASC";
break;
case "500000";
$query_rs_property = "SELECT * FROM propertydata WHERE price > 249999 AND <499999 ORDER BY price ASC";
break;
default;
$query_rs_property = "SELECT * FROM propertydata WHERE price > 499999 ORDER BY price ASC";
break;
}
Thanks
-
-
oops fixed it -
price > 249999 AND <499999
should have been
price > 249999 AND price < 499999
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks