我有以下代码从我的数据库中创建一个下拉列表:
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'];
}
返回值不是选择的那个。
你有什么想法可以帮助我吗?
谢谢 :)