我在 mysql 和数据库的下拉选择菜单中有问题
每当我从下拉选择值页面重新加载和页面刷新然后返回到选项选择选项?
function getComboB(sel) {
var roomtype=document.getElementById("roomtype");
var value = sel.options[sel.selectedIndex].value;
checkin.action = "checkin.php?item_combo="+value+"";
checkin.submit();
}
<select name="roomtype" id="roomtype" style="width:150px;" onchange="getComboB(this)">
<option><--Select--> </option>
$query=mysql_query("SELECT * FROM roomtype order by id");
while($row=mysql_fetch_assoc($query))
{
$val2=$row['id'];
?>
<option value="<?=$val2;?>" <? if ($roomtype == $val2) { echo "selected='selected'"; }?> > <?=$row['roomtype'];?> </option>
<?php }?>
</select>