title: Save value of Checkboxes in a form with php
body: <p>I need some help saving the value of the checkbox that user has selected.</p>
  
  <p>I have two checkboxes in the form:</p>
  
  <pre><code>&lt;form action="process.php" method="POST"&gt;
  Option One: &lt;input type="checkbox" name="check1" value="1"/&gt;
  Option Two: &lt;input type="checkbox" name="check2" value="2"/&gt;
  &lt;br&gt;
  
  &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  
  
  &lt;?php
  
  if(isset($_POST['check1'])){
  
  //execute function A
  
  
  }
  
  elseif(isset($_POST['check2'])){
  
  
  //execute function B
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>Now if the user ticks "Option One" and clicks submit, the checkbox remains checked and the php code executes some function otherwise if the user ticks "Option two" another function is executed and the checkbox 2 remains checked.</p>
  
  <p>Please someone help me sort this out.</p>
  
  <p>Thankyou!</p>