[eluser]Jow272[/eluser]
Hello all,
I'm having this weird problem. I'm using a single form_checkbox in a view but it only returns it's variable when it is checked.
The code:
in the view:
Code:
echo form_checkbox('restricted_cbx', 'R', !isset($restricted) ?
set_value('restricted_cbx') : $restricted) . $this->lang->line('view_restricted');
how it's value is retrieved in the controller:
Code:
$value = ($_POST['restricted_cbx'] == 'R') ? 'R' : 'P';
In all cases the checkbox is displayed in the view. If I check it and send the page everything is ok and the value is correct. But if I leave the checkbox unchecked I get a warning after sending the page that states "Undefined index: restreicted_cbx".
Can anyone tell me what I'm doing wrong?
Thanx in advance.
Michel