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 repopulat
I realised that set_checkbox takes 3 parameters :
set_checkbox(string $checkboxname, string $value, boolean $isChecked);
For example :
echo form_checkbox('mycbx[]',
$item['id'],
set_checkbox('mycbx[]', $item['id'], false)
);
or this way :
$checkbox = array(
'name' => 'mycbx[]',
'value' => $item['id'],
'checked' => set_checkbox('mycbx[]', $item['id'], false)
);
echo form_checkbox($checkbox);