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)

 <?php 
$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..

It has something to do with '.$sale_price.' I think

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

Any ideas?

    Write a Reply...