title: Insert checkbox data into database, based on if it is checked or not
body: <p>HTML:</p>
  
  <pre><code>&lt;form action="add.php" method="get" id="form"&gt;
    &lt;tr&gt;
      &lt;td&gt;SALE ITEM&lt;/td&gt;
      &lt;td&gt;
        &lt;input type="checkbox" name="saleItem" value="n" &lt;?php if(isset($_GET['saleItem'])) { ?&gt; checked="checked" value="y" &lt;?php } ?&gt; /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP (add.php)</p>
  
  <pre><code>$sql=("INSERT INTO table (sale) VALUES ('" . $_GET['saleItem'] . "')");
  if (!(mysql_query($sql))) { die ("could not query: " . mysql_error()); }
  </code></pre>
  
  <p>It always inserts an N regardless if it is checked. I would love if it inserted y based on if the checkbox is checked. I also tried to put the value="n" into an else after the if, but it always put N regardless as well (i removed the value="n" previous to the if when I did this), here is what I meant:</p>
  
  <pre><code>&lt;input type="checkbox" name="saleItem" &lt;?php if(isset($_GET['saleItem'])) { ?&gt; checked="checked" value="y" &lt;?php } else { ?&gt; value="n" &lt;?php } ?&gt; /&gt;
  </code></pre>