• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set_radio() within a form_radio() array

#1
[eluser]l2eqless[/eluser]
Would it be possible to use set_radio within a form_radio array? To do this within a text input, you simply put the function in the value part of the array, however the value within a radio button is used differently.

For instance, say I have 2 radio buttons:
Code:
$radio1 = array (
'name' => 'option',
'value' => 'option1',
'checked' => TRUE,
);
$radio1 = array (
'name' => 'option',
'value' => 'option2',
'checked' => FALSE,
);
echo form_radio($radio1);
echo form_radio($radio2);

Is there any way i can manipulate that arrays above to include the set_radio() function or would I simply have to simply use the following:
Code:
<input type="radio" name="option" value="option1" <?php echo set_radio('option', 'option1'); ?> />
<input type="radio" name="option" value="option2" <?php echo set_radio('option', 'option2'); ?> />

I'm asking simply because I feel using the arrays makes it easier on the eye if I ever have to go back and edit.

Thanks for the time!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.