標記,下拉列表選項
<span style="padding-left: 76px">
<span style="padding-left:5px">
<select id="select1" name="requestdbtype" value="<?php echo $type ?>">
<?php
$options = array('DB2' => 'DB2',
'MySQL' => 'MySQL',
'Oracle' => 'Oracle',
'PostgreSQL' => 'PostgreSQL',
'SQLite' => 'SQLite',
'SQL Server' => 'SQL Server',
'Sybase' => 'Sybase');
foreach($options as $value => $type){
echo "<option value='$value'>".$row['requestdbtype']."</option>";
}
?>
</select>
</span>
</span>
我在顯示選項麻煩
。顯示的當前選項應爲值$row['requestdbtype']
。但我的顯示器只顯示當前值作爲所有選項,請幫助。
rtfm。 [this](http://www.tizag.com/htmlT/htmlselect.php)例如 – k102
嗨,你已經使用'$ row ['requestdbtype']'作爲選擇框值,因此它顯示所有選項的當前值。使用'$ type'來代替'$ row ['requestdbtype']''。並將'if條件檢查$ value等於$ row ['requestdbtype']併爲該選項放置'selected'='selected'。謝謝 –