答案 0 :(得分:1)
试试这个
$person = array('abb' => 'Abbie', 'abi' => 'Abigail', 'ade' => 'Adelaide');
$selection = '<select>';
foreach ($person as $abbreviation => $name) {
$selection = $selection.'<option value="'.$abbreviation.'"';
if($name=='Abigail')
$selection .= 'selected';
$selection .= ">$name</option>";
}
$selection .= '</select>';
echo $selection;
如果我理解正确,这就是你想要的