我有以下代码从我的数据库创建一个下拉列表:
foreach( $aPlayers as $player ){
if( $_SESSION['player'] == $player->iPlayer ){
$playerSelected = $player->iPlayer;
}
$key = $player->iPlayer;
$value = ucfirst($player->sName);
$playersList[$key] = $value;
}
$form['gestionvideos_player']['selectplayer'] = array(
'#type' => 'select',
'#options' => $playersList,
'#default_value' => $playerSelected,
);
但是当我尝试提交表单并获得用户选择的值时:
function gestionvideos_players_form_submit($form, &$form_state){
echo $form_state['values']['selectplayer'];
}
返回值不是所选的值。
你有什么想法帮助我吗?
谢谢:)