title: Repopulating checkboxes in Codeigniter after Unsuccessful Form Validation
body: <p>I have a problem repopulating a set of checkboxes after an unsuccessful form validation returns the user back to the same form. Dropdown menus and text inputs could be repopulated, but not checkboxes!</p>
  
  <p>Here's a snippet of the code for the checkboxes:</p>
  
  <pre><code>        &lt;td&gt;
              &lt;?php echo form_checkbox('ambience[]', 'casual', set_checkbox('ambience[]', 'casual')); ?&gt; Casual &lt;br /&gt;
              &lt;?php echo form_checkbox('ambience[]', 'romantic', set_checkbox('ambience[]', 'romantic')); ?&gt; Romantic &lt;br /&gt;
              &lt;?php echo form_checkbox('ambience[]', 'outdoor', set_checkbox('ambience[]')); ?&gt; Outdoor / Alfresco &lt;br /&gt;
              &lt;?php echo form_checkbox('ambience[]', 'trendy', set_checkbox('ambience[]')); ?&gt; Hip &amp; Trendy &lt;br /&gt;
              &lt;?php echo form_checkbox('ambience[]', 'vibrant', set_checkbox('ambience[]')); ?&gt; Vibrant &lt;br /&gt;
              &lt;?php echo form_checkbox('ambience[]', 'up_scale', set_checkbox('ambience[]')); ?&gt; Upscale &lt;br /&gt;
          &lt;/td&gt;
  </code></pre>
  
  <p>The code snippet for text input which successfully repopulated is:</p>
  
  <pre><code>&lt;?php echo form_dropdown('price_range', $options, set_value('price_range')); ?&gt;
  </code></pre>
  
  <p>Any ideas? I'm really confused why <code>set_checkbox</code> does not work as advertised.</p>