3

I have two radio buttons on a form for example as below:

() Paul

() James

When I use the follwoing code, I am getting the values 0 or 1 depending on my selection. How can I get Paul or James? Thanks for your help.

$chosen =$form_state['values']['name_options'];

1 Answer 1

1

If the value you want is not in $form_state you can check in the $form parameter for the original form definition.

e.g:

$chosen = $form['name_options']['#options'][$form_state['values']['name_options']];
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.