By hello12345 on
Hi, I have drupal 5.2 installed, and I wanted to find out what the php format would be for a radio button consisting of two choices.
Here's some code I have so far, but it only shows up as one options. Thanks
You should only be allowed to pick either Personal Need or Business Need but not both. The title of the radio button will be "What is this for?"
$form['needs'] = array(
'#type' => 'radio',
'#title' => t('What is this for?'),
'#value' => 'p',
'#values' => array( 'p' => 'Personal Need', 'b' => 'Business Need'),
'#required' => TRUE
);
Comments
This should
This should work
Use #options instead of #values
Your close, the line
'#values' => array( 'p' => 'Personal Need', 'b' => 'Business Need'),should read
'#options' => array( 'p' => 'Personal Need', 'b' => 'Business Need'),nevets you're right
nevets, you're right, I copy&paste and don't saw that. Sorry for the mistake
...
and #type should be 'radios', not 'radio'.
Thank You!
Thank You!