title: How can I pass the value of a checkbox from one page to another?
body: <p>I am trying to pass a selected checkbox value from one page to another to run a mysql statement on my db.
  This is what I have:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form method='POST' action='move_compaudit.php'&gt;
  &lt;input type='hidden' name='checkbox' value='0'/&gt;
  &lt;input type='checkbox' name='checkbox' value='1'/&gt;
  </code></pre>
  
  <p><strong>PHP</strong> (this file called move_compaudit.php)</p>
  
  <pre><code>&lt;?php
    include('include/dbConnection.php');
    $checkbox = isset($_POST['checkbox']) ? 'Set' : 'NotSet';
    //SQL statement
    $query = "SELECT * FROM compaudit;";
    $results = mysqli_query($dbc,$query) or die('Error querying database');
    $row = mysqli_fetch_array($results);
    $query1 = "DELETE FROM compaudit WHERE serial_no = $row[7] AND $checkbox = 'Set'";    
    //Execute prepared MySQL statement
    //$results1 = mysqli_query($dbc,$query1) or die('Error querying database');
    print_r($query);
    print_r($query1);
  ?&gt;
  </code></pre>
  
  <p><strong>My badly printed query</strong>: I get this everytime, regardless of click or not clicked.</p>
  
  <pre><code>SELECT * FROM compaudit;DELETE FROM compaudit WHERE serial_no = 12345 AND Set = 'Set'
  </code></pre>