Results 1 to 2 of 2

Thread: passing value range via form post

  1. #1
    Join Date
    Jul 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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 &pound;250,000</option>
    <option value="500000">&pound;250K to &pound;500K</option>
    <option value="500001">over &pound;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

  2. #2
    Join Date
    Jul 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oops fixed it -
    price > 249999 AND <499999
    should have been
    price > 249999 AND price < 499999

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •