title: Working with MySQL and PHP to delete items on page
body: <p>I am unsure of what path I should take for what I am wanting to do. The page loads some data from a mysql database with php. I made it so that a check box is generated with an incremented value starting wit 0 and so on for every value it finds in the database. What I am wanting to do is have that check box be so that when it is checked and they push the trashcan icon it will delete that row from the database. Where I am unsure is how to go about deleting it on button click and then reload the page. What would be the best way to do this? I am not needing the code or anything I just cant think of the best path to take to accomplish this.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Print Run&lt;/title&gt;
  
  &lt;style type="text/css"&gt;
      .openRun{
          width:500px;    
      }
      .openRun th{
          text-align:center;
          background-color:#CCC;
      }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div&gt;
      &lt;?php
          $totals = 0;
          $i = 0;
          $companyName = "";
          $quantity = "";
          $cardSize = "";
          $dateAdded = "";
          require("serverInfo.php");
          $printRun = mysql_query("SELECT * FROM `printRun` WHERE status = 'Open'");
          $row = mysql_fetch_array($printRun);
          echo 'Print Run #: ' . $row['Run'];
          $result = mysql_query("SELECT * FROM `printRun` WHERE status = 'Open'");
  
          while($row = mysql_fetch_array($result)){
              $companyName[$i] = $row['Company'];
              $quantity[$i] = $row['Quantity'];
              $cardSize[$i] = $row['Size'];
              $dateAdded[$i] = $row['Date'];
              $totals = intval($row['Quantity']) + $totals;
              $i++;
          }
  
          $arraySize = count($companyName);
          echo '&lt;table class="openRun"&gt;';
          echo '&lt;tr&gt;&lt;th&gt;Company&lt;/th&gt;&lt;th&gt;Quantity&lt;/th&gt;&lt;th&gt;Size&lt;/th&gt;&lt;th&gt;Date Added&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;';
          for($i = 0; $i &lt; $arraySize; $i++){     
              echo '&lt;tr&gt;';
              echo '&lt;td&gt;' . $companyName[$i] . "&lt;/td&gt;";
              echo '&lt;td&gt;' . $quantity[$i] . "&lt;/td&gt;";
              echo '&lt;td&gt;' . $cardSize[$i] . "&lt;/td&gt;";
              echo '&lt;td&gt;' . $dateAdded[$i] . "&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input type="checkbox" name="box'. $i .'" value="'. $i .'" /&gt;&lt;/td&gt;';
              echo '&lt;/tr&gt;';
          }
          echo '&lt;tr&gt;';
          echo '&lt;td style="font-weight:bold; border-style:solid; border-top-width:1px;"&gt;Totals&lt;/td&gt;';
          echo '&lt;td style="font-weight:bold; border-style:solid; border-top-width:1px;"&gt;' . $totals . "&lt;/td&gt;";
          echo '&lt;td&gt;&lt;/td&gt;';
          echo '&lt;td&gt;&lt;/td&gt;';
          echo '&lt;td&gt;&lt;img src="images/trash.png" /&gt;&lt;/td&gt;';
          echo '&lt;/tr&gt;';
          echo '&lt;/table&gt;';
          mysql_close($link);
  
      ?&gt;
    &lt;br /&gt;
    &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>