I am creating a clothing website and say for a color on the sidebar I want to be able to submit a form with 'onClick' that will refresh the page, which it already does but to keep the checkbox checked when doing so. Right now my code submits properly refreshing the page and displaying the right products but the check in the checkbox is gone. I need the check to stay. Here is my code

$sidebar_color .= '<div id="sidebar">
<label><form action="?" method="REQUEST">
<input type="checkbox" name="color" value="'.$color.'" onClick="submit();" />
<font size="-2">
<a href="?color='.$color.'">'.$color.' ('.$row["COUNT(color)"].')</a> </font></form></label></div>';

Another problem is when the 'onClick="submit();"' refreshes the page and then I press back the checkbox is checked. I need it to be unchecked when I press back. Is this also possible?

I have been at this for days and tried too many things to remember what I tried. I know this probably requires Javascript or Ajax but I have no idea how to write that code.