title: php/mysql checkbox on vs. True vs. 1
body: <p>this should not be hard but I'm struggling with it so I thought I'd request help as I could not finding anything specific on web.</p>
  
  <p>I am posting from a checkbox on a form.  When I look at the querystring in browser window when I freeze output, it shows, the names of the variables = on.  Similarly, when I echo the posted values they show up as on.  The problem is when inserting into the dbase although inputting TRUE works, on does not. Fieldtype is tinyint(1).  Do I have to convert all the ons to TRUEs.  I feel like this has never been a problem before.</p>
  
  <pre><code>&lt;form action="processform.php" method="post"&gt;
  &lt;input type = "checkbox" name="var1" CHECKED&gt;
  &lt;input type = "checkbox" name="var2" CHECKED&gt;
  &lt;input type="submit" name="submit" value="submit"&gt;&lt;/form&gt;
  </code></pre>
  
  <p>script on other end.</p>
  
  <pre><code>$var1 = $_POST['var1'];
  $var2 = $_POST['var2'];
  echo $var1; //echoes "on"
  
  $sql = "INSERT into table (var1,var2) VALUES (TRUE,TRUE)"; //works
  $sql = "INSERT into table (var1,var2) VALUES ($var1,$var2)"; //does not work.
  $sql = "INSERT into table (var1,var2) VALUES ('$var1','$var2')"; //does not work.
  
  mysql_query($sql);
  </code></pre>
  
  <p>Is this a typo?  Can't imagine you really need to change "on" blank to TRUE or FALSE for each variable</p>