使用我所拥有的,这将显示下方框,顶部有一个空白条目,在Firefox中,如果我刷新页面,将显示所选值,在IE中没有这样的运气,我该怎么调整到获取所选值而不刷新页面?
<tr>
<td align="right">Department:</td>
<td align="left"><select name="department" width="145" style="width: 145px">
<option selected value="<?php echo $row['department'];?>"/></option>
<option value="Pack House">Pack House</option>
<option value="Picking">Picking</option>
<option value="Pick Tower">Pick Tower</option>
<option value="QA">QA</option>
<option value="Receiving">Receiving</option>
<option value="Replen">Replen</option>
<option value="Shipping">Shipping</option>
<option value="IT">IT</option>
<option value="Loaned">Loaned</option>
</select>
</tr>
答案 0 :(得分:1)
我找到了一个可行的解决方案
<td align="right">Department:</td>
<td align="left"><select name="department" width="145" style="width: 145px">
<option<?php if ($row['department'] == "Pack House"): ?> selected="selected"<?php endif; ?>>Pack House</option>
<option<?php if ($row['department'] == "Picking"): ?> selected="selected"<?php endif; ?>>Picking</option>
<option<?php if ($row['department'] == "Pick Tower"): ?> selected="selected"<?php endif; ?>>Pick Tower</option>
<option<?php if ($row['department'] == "QA"): ?> selected="selected"<?php endif; ?>>QA</option>
<option<?php if ($row['department'] == "Receiving"): ?> selected="selected"<?php endif; ?>>Receiving</option>
<option<?php if ($row['department'] == "Replen"): ?> selected="selected"<?php endif; ?>>Replen</option>
<option<?php if ($row['department'] == "Shipping"): ?> selected="selected"<?php endif; ?>>Shipping</option>
<option<?php if ($row['department'] == "IT"): ?> selected="selected"<?php endif; ?>>IT</option>
<option<?php if ($row['department'] == "Loaned"): ?> selected="selected"<?php endif; ?>>Loaned</option>
</select>
<tr>
感谢一位评论过的人..