Results 1 to 2 of 2

Thread: How to use both url and post variables on same target page

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

    Default How to use both url and post variables on same target page

    HI
    I need to target page to filter data based upon either the received url variable OR the received form post variable.

    I have two seperate bits of code which both work independently, ut when they are both use neither wokrs. How do I combine them? Thanks

    filter by received url:
    mysql_select_db($database_estateagent, $estateagent);

    switch($colname_rs_property)
    {
    case "1"; /* properties for sale */
    $query_rs_property = sprintf("SELECT * FROM propertydata WHERE offeredfor = 1 ORDER BY price ASC", $colname_rs_property);/*code for filtered list dep upon received url*/
    break;
    case "2"; /* properties for rent */
    $query_rs_property = sprintf("SELECT * FROM propertydata WHERE offeredfor = 2 ORDER BY price ASC", $colname_rs_property);/*code for filtered list dep upon received url*/
    break;
    default; /* all properties */
    $query_rs_property = sprintf("SELECT * FROM propertydata ORDER BY price ASC", $colname_rs_property); /*code for all properties*/
    break;
    }

    $query_limit_rs_property = sprintf("%s LIMIT %d, %d", $query_rs_property, $startRow_rs_property, $maxRows_rs_property);
    $rs_property = mysql_query($query_limit_rs_property, $estateagent) or die(mysql_error());
    $row_rs_property = mysql_fetch_assoc($rs_property);

    filter on post variable:
    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 price < 499999 ORDER BY price ASC";
    break;
    default;
    $query_rs_property = "SELECT * FROM propertydata WHERE price > 499999 ORDER BY price ASC";
    break;
    }

    $rs_property = mysql_query($query_rs_property, $estateagent) or die(mysql_error());
    $row_rs_property = mysql_fetch_assoc($rs_property);
    $totalRows_rs_property = mysql_num_rows($rs_property);

  2. #2
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    could you set the _GET var or url var as a hidden element and then pass it along as a _POST when the form is submitted?

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
  •