这是我在编辑页面中的多重选择下拉框。这里的问题是这只显示一个选定的项目。它不会显示其中的所有选定项目。我该如何纠正这个?
<?php
$query="SELECT * FROM lab";
$dropdown = "<select name='labid[]' multiple='multiple' style='height:80px;' size='5' id='lab'>";
//$dropdown .= "<option value=''>Select lab to assign </option>";
$result2 = mysql_query ($query);
while($row2 = mysql_fetch_assoc($result2))
{
$dropdown .= "\r\n<option value='{$row2['lab_id']}'";
while($row1 = mysql_fetch_assoc($result1))
{
if(($row1['lab_id'])==($row2['lab_id']))
{
$dropdown .=" selected='selected'";
}
}
$dropdown .= ">{$row2['l_name']}</option>";
}
$dropdown .= "\r\n</select>";
echo $dropdown;
?>