title: How to make a checkbox carry the correct value when checked or not
body: <p>When a checkbox is left blank I want it to carry the value "false" and when the checkbox is checked I want it to carry the value "true".</p>
  
  <pre><code>&lt;label for="windscreen"&gt;&lt;b&gt;Windscreen&lt;/b&gt;&lt;/label&gt;
          &lt;input class="form-control" id="windscreen" type="checkbox" name="windscreen"&gt;
  
          &lt;label for="heatedchairs"&gt;&lt;b&gt;Heated Chairs&lt;/b&gt;&lt;/label&gt;
          &lt;input class="form-control" id="heatedchairs" type="checkbox" name="heatedchairs"&gt;
  
          &lt;label for="indicators"&gt;&lt;b&gt;Indicators&lt;/b&gt;&lt;/label&gt;
          &lt;input class="form-control" id="indicators" type="checkbox" name="indicators"&gt;
  
          &lt;input class="btn btn-primary" type="submit" id="register" name="create" value="Sign up"&gt;
  
  
  &lt;script
     function register {
     document.getElementById("windscreen").checked = true;
     document.getElementById("windscreen").checked = false;
     }&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I have tried this for one of my checkboxes that has the id="windscreen", but it didn't do anything</p>
  
  <p>When the checkbox is checked it will return the value true and when it is unchecked it returns the value false. So in the database it will be saved as false or true, instead of it all being "on" as it is at the moment</p>