Select, radio and checkbox methods to implement default selection

小云云
Release: 2023-03-20 12:54:01
Original
1269 people have browsed it

This article mainly shares with you the implementation method of php select, radio and checkbox default selection. I hope it can help everyone.

select the implementation method of default selection

<select name="wuyeleixing" size="1">
<option <?php if($myrow[wuyeleixing]==1) echo "selected";?> value="1">住宅</option>
<option <?php if($myrow[wuyeleixing]==2) echo "selected";?> value="2">办公室</option>
</select>
Copy after login

The default selection implementation of radio radio button

<input type="radio" name="dishu" value="3" <?php if($myrow[dishu]==3) echo "checked";?>>空白
<input type="radio" name="dishu" value="1" <?php if($myrow[dishu]==1) echo "checked";?>>出让
Copy after login

checkbox Checkbox default selection implementation

<input name="fujia_jiaju" type="checkbox" value="jiaju" <?php if($myrow[fujia_jiaju]) echo "checked";?>></font></strong>家 具</td>
<td width="108" height="1"><strong><font color="#008080" face="楷体_GB2312"><input
name="fujia_chuju" type="checkbox" value="chuju" <?php if($myrow[fujia_chuju]) echo "checked";?>></font></strong>厨 具</td>
Copy after login

The above is the detailed content of Select, radio and checkbox methods to implement default selection. For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!