当我从数据库表中选择下拉值然后刷新页面时,该值返回到选择选项
这是我的代码:
<select name="customers" id="customers" style="width:150px;" >
<option value=""><--Select--></option>
<?php
$query=mysql_query("SELECT cn FROM customerinformation order by id");
while($row=mysql_fetch_assoc($query))
{
$val2=$row['cn'];
?>
<option value="<?=$val2;?>"
<?if ($_REQUEST['cn'] == $val2){ echo "selected='selected'"; }?>>
<?=$row['cn'];?>
</option>
<?php }?>
</select>
请告诉我或指导我哪里做错了。提前致谢!