title: checkbox onclick wont change checked via jscript
body: <p>I have 3 checkboxes, i wish to be able to click the box and it tick on/off and via jscript change the value of the input for posting to state weather item is accepted or not on another page. However i have logical script but it wont work, theres no errors but the checkboxes wont click on/off they just click on and thats it.. and the value wont change either i dont understand why. </p>
  
  <p>Could somebody look at this short code and tell me why.</p>
  
  <p>Thank you.</p>
  
  <pre><code>&lt;input  type="checkbox" id="paypal" name="paypal1"  value=" " onclick='chbxpp();' &gt;
  &lt;/input&gt;
  &lt;label for="paypal" class="checkboxes" &gt;Show PayPal Accepted&lt;/label&gt;
  
  &lt;br&gt;
  
  &lt;input   type="checkbox" id="facebook"  name="facebook"  value=" "  onclick='chbxfb(this);' &gt;
  &lt;/input&gt;
  &lt;label for="facebook" class="checkboxes"  &gt;Show FaceBook Contact Details&lt;/label&gt;
  
  &lt;br&gt;
  
  &lt;input   type="checkbox" id="twitter"  name="twitter"  value=" "  onclick='chbxtw(this);' &gt;
  &lt;/input&gt;
  &lt;label for="twitter" class="checkboxes"  &gt;Show Twitter Contact Details&lt;/label&gt;
  
  
  
  function chbxpp()
  {
  
  if(document.getElementById('paypal').checked === true) {
  document.getElementById('paypal').checked = false;
  document.getElementById('paypal').value='no';
  
  var vv=document.getElementById('paypal').value;
  console.log(vv);
  }
  
  if (document.getElementById('paypal').checked === false) {
  document.getElementById('paypal').checked = true;
  document.getElementById('paypal').value='yes';
  var vv=document.getElementById('paypal').value;
  console.log(vv);
  }
  
  }
  
  
  
  
  function chbxfb(objfb)
  {
  var that = objfb;
  
  (objfb);
  
  if(document.getElementById(that.id).checked === true) {
  document.getElementById(that.id).checked = false;
  document.getElementById(that.id).value='no';
  
  var vv=document.getElementById(that.id).value;
  
  console.log(vv);
  
  }
  
  if (document.getElementById(that.id).checked === false) {
  document.getElementById(that.id).checked = true;
  document.getElementById(that.id).value='yes';
  
  var vv=document.getElementById(that.id).value;
  
  console.log(vv);
  
  }
  
  }
  
  
  
  function chbxtw(objtw)
  {
  var that = objtw;
  (objtw);
  
  
  if(document.getElementById(that.id).checked === true) {
  document.getElementById(that.id).checked = false;
  document.getElementById(that.id).value='no';
  var vv=document.getElementById(that.id).value;
  console.log(vv);
  }
  
  if (document.getElementById(that.id).checked === false) {
  document.getElementById(that.id).checked = true;
  
  document.getElementById(that.id).value='yes';
  
  var vv=document.getElementById(that.id).value;
  
  console.log(vv);
  
  }
  
  }
  </code></pre>
  
  <p>The objpp was my attempt at another method but just does the same thing...</p>
  
  <p>p.s if i just didnt use jscript and just had the html, would the value not be valid if the checkbox was not clicked or would the value still be sent...</p>
  
  <p>iv just fond this..</p>
  
  <p><a href="https://stackoverflow.com/questions/9140633/how-to-change-the-value-of-a-check-box-onclick-using-jquery">How to change the value of a check box onClick using JQuery?</a></p>
  
  <p>states that the value wont be sent if the box is unchecked... But then how do i know after post what has been clicked.... will i receieve a not isset($_POST['paypal'])   or an empty($_POST['paypal'])</p>