Home > Backend Development > PHP Tutorial > php中怎么设置<select></select>中的默认项

php中怎么设置<select></select>中的默认项

WBOY
Release: 2016-06-13 13:19:24
Original
1014 people have browsed it

php中如何设置中的默认项
从数据库中读取相关数据绑定到标记,如何让数据库中的值默认绑定到的第一项,比如数据库列是男,的默认选中就是男

------解决方案--------------------
加上 selected=selected

比如:


------解决方案--------------------
首先,基本的用法就是;
如果是要查询数据库中,是其成为默认的某一项,那就得写查询语句了,先查出来,然后再嵌套进去php输出,就可以了,例如::

希望对楼主有帮助。

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