04-20-2010, 04:21 AM
[eluser]Wayne Smallman[/eluser]
Hi guys!
I'm trying to code up radio buttons, but it's not working out.
In the form, I have:
However, while they're being grouped, it's not checking cash (there isn't even a checked attribute) and their values are being set to Array.
The help documentation isn't all that helpful in terms of syntax. Just saying that form_radio() is almost the same as form_checkbox() isn't as instructive as actually providing code for the grouping, values etc.
Any ideas?
Hi guys!
I'm trying to code up radio buttons, but it's not working out.
Code:
$input_common['cash'] = array (
'name' => 'cash',
'id' => 'cash',
'value' => ($this->arrayClassAttributes['results']['entries'][0]['category'] == 'cash') ? $this->arrayClassAttributes['results']['entries'][0]['category'] : set_value('cash'),
'checked' => true
);
$input_common['bank'] = array (
'name' => 'bank',
'id' => 'bank',
'value' => ($this->arrayClassAttributes['results']['entries'][0]['category'] == 'bank') ? $this->arrayClassAttributes['results']['entries'][0]['category'] : set_value('bank'),
'checked' => false
);
In the form, I have:
Code:
<dt><?php echo form_label('Cash?', $input_common['cash']['id']); ?></dt>
<dd><?php echo form_radio("category", $input_common['cash']); ?></dd>
<dt><?php echo form_label('Bank?', $input_common['bank']['id']); ?></dt>
<dd><?php echo form_radio("category", $input_common['bank']); ?></dd>
However, while they're being grouped, it's not checking cash (there isn't even a checked attribute) and their values are being set to Array.
The help documentation isn't all that helpful in terms of syntax. Just saying that form_radio() is almost the same as form_checkbox() isn't as instructive as actually providing code for the grouping, values etc.
Any ideas?