Home  >  Article  >  Backend Development  >  Select, radio and checkbox methods to implement default selection

Select, radio and checkbox methods to implement default selection

小云云
小云云Original
2018-02-26 10:32:511317browse

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>

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";?>>出让

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>

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!

Statement:
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