我在页面上有一个下拉菜单,在用户将内容添加到数据库后,我不希望从 dorpdown 菜单中添加的特定值再次显示在列表中。我不想从下拉表中删除该特定值。你的帮助会做的。
下面是我的代码:
<?php
$query = "SELECT * FROM vreg_no order by vreg desc";
$rs = mysql_query($query);
while($row = mysql_fetch_assoc($rs))
{{
$_SESSION['svregx'] = $row['vreg'];
}}
?>
<select name="svreg" class="bodytxt" id="svreg">
<option>Select Vehicle #</option>
<?php
$query = "SELECT * FROM vreg_no order by vreg desc";
$rs = mysql_query($query);
while($row = mysql_fetch_assoc($rs))
{{
$vreg = $row['vreg'];
if($_SESSION['svregx'] == $vreg){
//do nothing
}
elseif($_SESSION['svregx'] != $vreg){
echo"<option value='$vreg'>$vreg</option>";
}else{}
}}
?>
</select>