title: PHP Submit form only if checkbox is ticked
body: <p>I have a problem with a wordpress widget that I developed.</p>
  
  <p>It 's just a form with an email field, a button and a checkbox.</p>
  
  <p>When the user click on submit, I want to verify if the checkbox is ticked and IF YES submit the form...</p>
  
  <p>My problem is that the form is submitted even tough the checkbox is not ticked. The page is reloaded.</p>
  
  <p>Here is a short version of my code : </p>
  
  <pre><code>&lt;?php if(isset($_POST['rules']) &amp;&amp; $_POST['rules'] == 'Yes') 
  {
          echo 'The checkbox was selected'; 
  } else {
          echo 'The checkbox wasn\'t selected';
  } ?&gt;
  
  &lt;form id="form-invite" method="post" action=""&gt;
      &lt;label&gt;Your friend(s) email :&lt;/label&gt;
      &lt;br/&gt;
      &lt;small style="text-transform:uppercase;font-family:Arial;font-size:9px;color:#333;"&lt;em&gt;Multiple emails separated by comma.&lt;/em&gt;&lt;/small&gt;
      &lt;input class="kolom" type="text" name="email" id="email"/&gt;
      &lt;input class="button-primary classic-button" type="submit" name="send-them" value="Send Invitation"/&gt;
      &lt;input type="checkbox" name="rules" value="Yes" /&gt; &lt;span id="rulesInfo"&gt;I read the Privacy Policy&lt;/span&gt;&lt;br/&gt;
      &lt;span id="emailInfo"&gt;&lt;/span&gt;
  &lt;/form&gt;
  </code></pre>