title: How do update a specific row using checkboxes
body: <p>I'm trying to update specific rows in a table that is built from a form. I am using checkboxes but the whole table is being updated instead of the specific row that I am filling in. I tried ISSET to see if I could get it to only update when the boxes were ticked, but that didn't work. Here's what I have (obviously not the whole code, but I can provide more as needed):</p>
  
  <pre><code>&lt;?php
  
  include 'connect.php';
  
  
  // All possible parameters
  $params = array(
      'Student',
      'homeroom',
      'teacher'
  
  );
  
  $wheres = array();
  foreach ($params as $param) {
  
      // Is the param set?
      // If so, let's add it to our list of WHERE clauses
      if (isset($_GET[$param]) &amp;&amp; !empty($_GET[$param])) {
          $wheres[] = sprintf("%s LIKE '%%%s%%'", $param, mysqli_real_escape_string($connect, $_GET[$param]));
      }
  }
  
  if ($db_found) {
  
      // Now let's make the SQL.
      $SQL = 'SELECT * FROM studentlist';
  
      // We only want to add the WHERE clause if we had some parameters passed
      if (count($wheres) &gt; 0) {
          $SQL .= ' WHERE ' . implode(' OR ', $wheres);
      }
  
  
  
      $result = mysqli_query($connect, $SQL);
  
  
  
      while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
  
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" . $row['Student'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['homeroom'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='responsibility' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='responsibility' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='responsibility' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='responsibility' value='N'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='organization' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='organization' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='organization' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='organization' value='N'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='independentwork' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='independentwork' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='independentwork' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='independentwork' value='N'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='collaboration' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='collaboration' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='collaboration' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='collaboration' value='N'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='initiative' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='initiative' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='initiative' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='initiative' value='N'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='selfregulation' value='E'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='selfregulation' value='G'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='selfregulation' value='S'&gt;" . "&lt;/td&gt;";
    echo "&lt;td&gt;" . "&lt;input type='checkbox' name='selfregulation' value='N'&gt;" . "&lt;/td&gt;";
  
    echo "&lt;/tr&gt;"; 
  </code></pre>
  
  <p>And then I have this as my update:</p>
  
  <pre><code>            &lt;?php
  
          include 'connect.php';
  
  
  
          // Get values from form 
          $resp=$_POST['responsibility'];
          $org=$_POST['organization'];
          $ind=$_POST['independentwork'];
          $coll=$_POST['collaboration'];
          $init=$_POST['initiative'];
          $self=$_POST['selfregulation'];
  
  
  
         // Insert data into mysqli 
         $sql = "UPDATE studentlist 
         SET responsibility='$resp', organization='$org', independentwork='$ind', 
         collaboration='$coll', initiative='$init', selfregulation='$self'";
  
         $result=mysqli_query($connect, $sql);
  
         // if successfully insert data into database, displays message "Successful". 
         if($result){
         echo "Successful";
  
  
         }
  
         else {
         echo "ERROR";
         }
         ?&gt; 
  
  &lt;?php 
  // close connection 
  mysqli_close($connect);
  ?&gt;
  </code></pre>
  
  <p>I understand that I have all the checkboxes named the same thing, but I'm not sure how to move away from that. And yes, I am new to this!!!!!</p>