Welcome Guest, Not a member yet? Register   Sign In
set_radio() is inconvenient.
#2

[eluser]fesweb[/eluser]
set_radio is not intended to return the value of the radio button, it is intended to return the radio button's state.

Try it like this instead, using a boolean test as the third parameter:
Code:
$radio_state = set_radio('my_field', 'car', $my_field == 'car');
$data = array(
    'name'        => 'my_field',
    'value'       => 'car',
    'checked'     => $radio_state
    );
echo form_radio($data);

Without the form_radio function it would look like this:
Code:
<input type="radio" name="my_field" value="house"<?php echo set_radio('my_field', 'house', $my_field == 'house'); ?>>
<input type="radio" name="my_field" value="car"<?php echo set_radio('my_field', 'car', $my_field == 'car'); ?>>


Messages In This Thread
set_radio() is inconvenient. - by El Forum - 03-29-2011, 06:44 AM
set_radio() is inconvenient. - by El Forum - 03-29-2011, 09:35 AM
set_radio() is inconvenient. - by El Forum - 10-26-2012, 02:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB