Home > Backend Development > PHP Tutorial > 如何隐藏下拉框的值

如何隐藏下拉框的值

WBOY
Release: 2016-06-13 12:22:01
Original
1773 people have browsed it

怎么隐藏下拉框的值
假设 php网站中

引用


如果在数据库中 有1 服务类 的记录 

那么下次提交表单的时候  隐藏  这条  

怎么实现?
------解决思路----------------------
<br /><?php<br />$exists = array(1,2); // 这个表示从数据库中读取到已经有的记录。放到这个数组中,读数据库你自己写就可以了。<br /><br />?><br /><select id="hangye" name="hangye"><br /><option value="0">请选择</option><br /><?if(!in_array(1, $exists)){?><br /><option value="1">服务类</option><br /><?}?><br /><?if(!in_array(2, $exists)){?><br /><option value="2">制造类</option><br /><?}?><br /><?if(!in_array(3, $exists)){?><br /><option value="3">广告类</option><br /><?}?><br /></select><br />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template