Checkbox onChange submit problem if checked
<p>The purpose is to have a checkbox, that if clicked, will send via post where I will update the db. The user can check back and forth to set or unset active status.</p>

<p>This works perfectly:</p>

<pre><code>&lt;form name='form".$value['id']."' action='./filter_edit.php' method='post'&gt;&lt;input type='checkbox' name='checkbox[".$value['id']."]' value='".$newActive."' onclick='document.form".$value['id'].".submit();' /&gt;&lt;/form&gt;
</code></pre>

<p>However, using the code above, the box never appears checked.</p>

<p>With the below code, once the field is set to active where the box will be checked, clicking to uncheck the box does submit but sends no post variables.</p>

<pre><code>&lt;form name='form".$value['id']."' action='./filter_edit.php' method='post'&gt;&lt;input type='checkbox' name='checkbox[".$value['id']."]' value='".$newActive."'";
        if($value['active'] == 1)
         echo " checked='checked'";
        echo" onclick='document.form".$value['id'].".submit();' /&gt;&lt;/form&gt;
</code></pre>
