title: Checked checkbox and onclick redirect to another page in PHP
body: <p>I have a login form and a section with 3 checkboxes and a final submit button. I want to write code such that when a checkbox is checked, and the submit button is clicked, the user will be redirected to another page depending on which checkbox was checked. </p>
  
  <p>I have:</p>
  
  <pre><code>&lt;input type="checkbox" name="gender" value="male"&gt;
  &lt;input type="checkbox" name="gender" value="female"&gt;
  </code></pre>
  
  <p>I know that you can use</p>
  
  <pre><code>if (isset($_POST['male'])) {
      // Checkbox male is selected
  } else {
      // Do something else
  }
  </code></pre>
  
  <p>To see if the checkbox is checked, and </p>
  
  <pre><code> &lt;input type="button" value="goElsewhere" class="GE" id="GELSEWHERE" 
    onClick="Javascript:window.location.href = 'http://www.google.com';" /&gt;
  </code></pre>
  
  <p>For a page redirect when the button is clicked.</p>
  
  <p>But I'm not sure how to combine these. How would I go about it?</p>
  
  <p>Edit: The page should redirect only after the final submit button is clicked. The checkboxes should only determine which page the user is directed to. Checking a checkbox should not redirect the page.</p>