title: How to submit 0 if checkbox is unchecked and submit 1 if checkbox is checked in HTML
body: <p>How to submit value 1 if a checkbox in a checkbox array is checked, and submit 0 if it's unchecked? I tried this but no luck. I am trying to grab this array in a php array when the form is submitted. Please help!</p>
  
  <pre><code>&lt;input id = 'testName0' type = 'checkbox' name = 'check[0]' value = '1' checked&gt;
  &lt;input id='testNameHidden0'  type='hidden' value='0' name='check[0]'&gt;
  
  &lt;input id = 'testName1' type = 'checkbox' name='check[1]' value = '1' unchekced&gt;
  &lt;input id='testNameHidden1'  type='hidden' value='0' name='check[1]'&gt;
  
  &lt;input type = 'submit' value = 'Save Changes'&gt;
  &gt;
  &lt;script&gt;
  if(document.getElementById('testName0').checked){
    document.getElementById('testNameHidden0').disabled = true;
  }
  &lt;/script&gt;
  
  &lt;script&gt;
  if(document.getElementById('testName1').checked){
    document.getElementById('testNameHidden1').disabled = true;
  }
  &lt;/script&gt;
  </code></pre>