Results 1 to 5 of 5

Thread: PHP form to display query

Threaded View

  1. #1
    Join Date
    May 2014

    PHP form to display query

    I have this code which displays all my products with a price range of $0-$25 great on left side of my webpage with the count number beside it like so.

    $0-$25 (12)
        $sidebar_price ="";
        $price_sql = mysql_query("SELECT *,COUNT(sale_price) FROM products WHERE subcategory =      
        'Shirts' AND category = 'Women' AND (sale_price BETWEEN '$00.00' AND '$25.00') GROUP BY   
        (sale_price BETWEEN '$00.00' AND '$25.00')");
        $prCount = mysql_num_rows($price_sql);
        if ($prCount > 0) {
    	while($row = mysql_fetch_array($price_sql)){
    		$sale_price = $row["sale_price"];
    		$sidebar_price .= '<div id="sidebar"><label><form action="?"method="REQUEST"><input type="checkbox" name="sale_price" value="'.$sale_price.'" 
         onClick="submit(); return false" ' . (isset($_REQUEST['sale_price']) && $_REQUEST['sale_price']==$row['sale_price'] ? 'checked="checked"' : '') . ' /><font 
         size="-2"><a href="?sale_price='.$sale_price.'">$0-$25 ('.$row["COUNT(sale_price)"].')</a></font></form></label></div>';
    How do I get it to work for the href and onclick?

    When I click on the href or onclick it will only display the products with prices for example just $24.99 and not all the products between $0.00-$25.00 like $24.99, $22.6, 19.35, etc..

    The problem might be is with the '.$sale_price.' I think

    If it is not clear enough I will try to explain further.

    Any ideas?
    Last edited by jedaisoul; 06-02-2014 at 03:25 AM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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