title: In Codeigniter, how to validate radio buttons (without "checked")?
body: <p>In Codeigniter, I would like to validate radio buttons but I don't want to select one when the user loads the page (I mean <strong>no "checked" attribute</strong>).</p>
  
  <p>This is what I have done so far...</p>
  
  <p>My view file:</p>
  
  <pre><code>&lt;?=validation_errors()?&gt;
  &lt;form action="step1" method="post"&gt;
      &lt;input name="food" type="radio" value="1" &lt;?=set_radio('food', '1')?&gt; /&gt;
      &lt;input name="food" type="radio" value="2" &lt;?=set_radio('food', '2')?&gt; /&gt;
      &lt;input name="food" type="radio" value="3" &lt;?=set_radio('food', '3')?&gt; /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My controller file:</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('food', 'food', 'required');
  if ($this-&gt;form_validation-&gt;run() == TRUE) redirect('step2');
  </code></pre>
  
  <p>The error message only appears if I add a field like an <code>&lt;input type="text"&gt;</code>. But my wish is to have only 3 radio buttons and an error message if none are selected.</p>
  
  <p>Do you know how to do that?</p>