Is there a way to make to checkbox react to the form value which is '.$color.' instead of the form name which is color. When I submit right now the code will check all of the colors fetched from the database but I want it to only check the individual color it clicked on. Here is my code.
<?php
$sidebar_color ="";
$color_sql = mysql_query("SELECT *,COUNT(color) FROM products GROUP BY color ORDER BY color ASC");
$coCount = mysql_num_rows($color_sql);
if ($coCount > 0) {
while($row = mysql_fetch_array($color_sql)){
$color = $row["color"];
$sidebar_color .= '<div id="sidebar"><label><form action="?" method="REQUEST"><input type="checkbox" name="color" value="'.$color.'" onClick="submit(); return false" ' . (isset($_REQUEST['color']) ? 'checked="checked"' : '') . ' /><font size="-2"><a href="?color='.$color.'">'.$color.' ('.$row["COUNT(color)"].')</a></font></form></label></div>';
}
}
?>
My page will look something like this
checkbox black (3)
checkbox yellow (5)
checkbox white (9)
...
All the pages are different and vary all the time so I can't individually write out the colors in the form which is why I use '.$color.'
I hope this is a little more clear. Any ideas?