title: How to explode array and assign chunks to respective checkbox fields?
body: <p>Following situation: I stored a checkbox array with implode in a mysql table field. Now, in order to update the checkboxes, I want to read the table field content, explode it into its parts and assign it to the respective checkboxes.</p>
  
  <p>So far I managed to read out and explode the table field content into different chunks, my difficulty is how to assign to the respective checkboxes.</p>
  
  <p>Here is the checkbox field:</p>
  
  <pre><code>&lt;tr&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="Automotive" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;Automotive&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="Backlights" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;Backlights&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="LED lighting" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;LED lighting&lt;/label&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="IR" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;IR&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="Signage/Traffic Lights" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;Signage/Traffic lights&lt;/label&gt;&lt;/td&gt;
     &lt;td&gt;&lt;input class="field checkbox" type="checkbox" name="appbox[]" value="Mobile Devices" &lt;?php $appbox_checked ?&gt; /&gt;&lt;label class="choice"&gt;Mobile devices&lt;/label&gt;&lt;/td&gt;
    &lt;/tr&gt;
  </code></pre>
  
  <p>and here is the php code:</p>
  
  <pre><code>$storebox = explode(", ", $chunk0);
      for($i = 0; $i &lt; count($storebox); $i++){
      echo "Piece $i = $storebox[$i] &lt;br /&gt;";
      }
  </code></pre>
  
  <p>The chunk content matches the value field of the checkbox. So what I need is basically:</p>
  
  <p>if 'chunk content' = 'checkbox value'
  then <code>&lt;?php $appbox_checked ?&gt;</code> will echo 'checked'</p>
  
  <p>Or maybe there is a simplier solution. Thanks for you help guys!</p>