title: Updating Checked Checkboxes using CodeIgniter + MySQL
body: <p>I have about 8 check boxes that are being generated dynamically from my database.</p>
  
  <p>This is the code in my controller</p>
  
  <pre><code>//Start Get Processes Query
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('projects_processes');
      $this-&gt;db-&gt;where('process_enabled', '1');
      $data['getprocesses'] = $this-&gt;db-&gt;get();
      //End Get Processes Query
  
      //Start Get Checked Processes Query
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('projects_processes_reg');
      $this-&gt;db-&gt;where('project_id', $project_id);
      $data['getchecked'] = $this-&gt;db-&gt;get();
      //End Get Processes Query
  </code></pre>
  
  <p>This is the code in my view.</p>
  
  <pre><code>&lt;?php if($getprocesses-&gt;result_array()) { ?&gt;
  &lt;?php foreach($getprocesses-&gt;result_array() as $getprocessrow): ?&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;input &lt;?php if($getchecked-&gt;result_array()) { foreach($getchecked-&gt;result_array() as $getcheckedrow): if($getprocessrow['process_id'] == $getcheckedrow['process_id']) { echo 'checked'; } endforeach; }?&gt; type="checkbox" name="progresscheck[]" value="&lt;?php echo $getprocessrow['process_id']; ?&gt;"&gt;&lt;?php echo $getprocessrow['process_name']; ?&gt;&lt;br&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>This generates the checkboxes into the form and also checks the appropriate ones as specified by the database.</p>
  
  <p><strong>The problem is updating them.</strong></p>
  
  <p>What I have been doing so far is simply deleting all checkbox entries for the project and then re-inserting all the values into the database. This is bad because 1. It's slow and horrible. 2. I lose all my meta data of when the check boxes were checked.</p>
  
  <p><strong>So I guess my question is, how do I update only the checkboxes that have been changed?</strong></p>
  
  <p>Thanks,
  Tim</p>