title: How to validate a Checkbox form in Codeigniter and re-populate checked
body: <p>Obivously, I have 2 problems. </p>
  
  <ol>
  <li><p>When I submit a checkbox form which is an array value and non-cheched form, It doesn't show me validation error such as 'this field is required'. It shows error when I check one of them. Normally it should have shown me even though I don't check anything on the form and just press submit. </p></li>
  <li><p>How can I repopulate a checkbox as checked when I submit as checked. Think like set_value. In set_value it populates previous data. At this I want it to be auto checked when if I had submitted.</p></li>
  </ol>
  
  <p>My controller</p>
  
  <pre><code>function preferences() {
      $user = $this-&gt;ion_auth-&gt;user()-&gt;row();
      $data['first_name'] = $user-&gt;first_name;
      $data['last_name'] = $user-&gt;last_name;
      $data['user_id'] = $user-&gt;id;
      $data['address'] = $this-&gt;main_model-&gt;office_zip_match($user-&gt;zipcode);
  
      $this-&gt;form_validation-&gt;set_rules('days[]', 'Days', 'required');
      $this-&gt;form_validation-&gt;set_rules('contact[]', 'Contact', 'required');
  
      if ($this-&gt;form_validation-&gt;run() == true) {
          echo print_r($this-&gt;input-&gt;post());
      } else {
          $this-&gt;load-&gt;view('auth/preferences', $data);
      }
  }
  </code></pre>
  
  <p>My view:</p>
  
  <pre><code>&lt;div&gt;Days to Deliver&lt;/div&gt;
  &lt;?php echo form_open('signup/preferences'); ?&gt;
  &lt;input type="checkbox" name="days[]" value="monday" id="days" /&gt; Monday&lt;br /&gt;
  &lt;input type="checkbox" name="days[]" value="tuesday" id="days" /&gt; Tuesday&lt;br /&gt;
  &lt;input type="checkbox" name="days[]" value="wednesday" id="days" /&gt; Wednesday&lt;br /&gt;
  &lt;input type="checkbox" name="days[]" value="thursday" id="days" /&gt; Thursday&lt;br /&gt;
  &lt;input type="checkbox" name="days[]" value="friday" id="days" /&gt; Friday&lt;br /&gt;
  &lt;div&gt;How would you like us to contact you? (When package arrives / for all other issues&lt;/div&gt;
  &lt;input type="checkbox" name="contact[]" value="email" id="contact" /&gt; Email&lt;br /&gt;
  &lt;input type="checkbox" name="contact[]" value="text" id="contact" /&gt; Text&lt;br /&gt;
  &lt;input type="checkbox" name="contact[]" value="cell" id="contact" /&gt; Cell&lt;br /&gt;
  &lt;div&gt;&lt;input type="submit" value="Send" /&gt;&lt;/div&gt;
  &lt;?php echo form_close(); ?&gt;
  &lt;?php echo validation_errors(); ?&gt;
  </code></pre>