title: how to save checkbox value into mysql database using php
body: <p>hi i have a form which has a checkbox and i want to save the value of the checkbox into my database but when i click on the checkbox and save it it works fine and when i try to save the form without checking on the chekbox  it shows undefined index can any one help me out </p>
  
  <p>here is my html</p>
  
  <pre><code>&lt;input type="checkbox" name="active" value="1"&gt;&lt;/input&gt;
  </code></pre>
  
  <p>here is my php</p>
  
  <pre><code>$nactive  = $_POST["active"];
  </code></pre>
  
  <p>here is my save part</p>
  
  <pre><code>mysql_query("INSERT INTO `usermain`( `username`, `password`, level, active,`zimname`, zimmob, `email`, admin, makhtab)
              Values
                     ('$nuser', '$npwd', '$nlevel', '$nactive', '$nzname', '$nzmob', '$nemail', '0', '$makh')") or die(mysql_error());
  </code></pre>