本篇文章是对php selectradio和checkbox默认选择的实现方法进行了详细的分析介绍
需要的朋友参考下
这是扩展yibing的select默认选择的实现方法
复制代码 代码如下:
<select name="wuyeleixing" size="
">
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">住宅</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">办公室</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">营业房</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">厂房</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">仓库</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">地块</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">综合楼</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">农牧场</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">商住楼</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">宾馆酒楼</option>
<option <?php if($myrow[wuyeleixing]==
) echo("selected");?> value="
">校捨</option>
</select>
radio单选框的默认选择实现
复制代码 代码如下:
<input type="radio" name="dishu" value="
" <?php if($myrow[dishu]==
) echo("checked");?>>空白
<input type="radio" name="dishu" value="
" <?php if($myrow[dishu]==
) echo("checked");?>>出让
<input type="radio" name="dishu" value="
" <?php if($myrow[dishu]==
) echo("checked");?>>划拨
<input type="radio" name="dishu" value="
" <?php if($myrow[dishu]==
) echo("checked");?>>集体
checkbox 复选框的默认选择实现
复制代码 代码如下:
<input name="fujia_jiaju" type="checkbox" value="jiaju" <?php if($myrow[fujia_jiaju]) echo("checked");?>></font></strong>家 具</td>
<td width="
" height="
"><strong><font color="#
" face="楷体_GB
"><input
name="fujia_chuju" type="checkbox" value="chuju" <?php if($myrow[fujia_chuju]) echo("checked");?>></font></strong>厨 具</td>
<td width="
" height="
"><strong><font color="#
" face="楷体_GB
"><input
name="fujia_woju" type="checkbox" value="woju" <?php if($myrow[fujia_woju]) echo("checked");?>></font></strong>卧 具</td>
<td width="
" height="
"><strong><font color="#
" face="楷体_GB
"><input
name="fujia_TV" type="checkbox" value="TV" <?php if($myrow[fujia_TV]) echo("checked");?>></font></strong>电视机