Welcome Guest, Not a member yet? Register   Sign In
Form validation - set_checkbox() issue
#1

[eluser]Zeff[/eluser]
Hi,

I made a form using CI form helper and form validation library. Everything works fine, except that the set_value() for a checkbox field (actually: set_checkbox()) does not work.

My code:
Code:
echo '<div>';
echo form_fieldset('Membership Status');

  $label_opt = array('class' => 'labelCheckbox');
  $chkbox_opt = array('name' =>'student', 'value' => 'yes', 'class' => 'inputCheckbox');                    
  
  echo form_label(form_checkbox($chkbox_opt, '', set_checkbox('student', 'yes')) . 'I am a student', 'lbl_status', $label_opt);
            
echo form_fieldset_close();
        
echo '</div>';

In my browser, I see:
Code:
<div>
<fieldset>
<legend>Membership Status</legend>
<label for="lbl_status" class="labelCheckbox">
&lt;input type="checkbox" name="student" value="yes" class="inputCheckbox"&gt;
I am a student
</label>
</fieldset>
</div>

But the set_checkbox() function doesn't seem to work...

Any suggestions?

Thanks!

Zeff




Theme © iAndrew 2016 - Forum software by © MyBB