$langoptions = array(1=>'German',2=>'English',3=>'Spanish',4=>'French',5=>'Portuguese',6=>'Chinese',7=>'Italian',8=>'Japanese');
$form['language'] = array(
'#type' => 'checkboxes',
'#title' => 'Language',
'#multiple'=> TRUE,
'#options'=> $langoptions,
);
开发者_如何学编程
Created a list of check box like this and in callback I tried to access it as
foreach ($_POST['language'] as $key => $value) {
echo $value;
}
and it does not display any value, can any one help me in fixing this?
If you're using standard form API, the postdata should be in $form_state['values'] at hook_submit().
Just to be sure -- have you checked any of the checkboxes prior to submitting? They will only be sent in POST if checked.
精彩评论