本篇文章是對php selectradio和checkbox默認選擇的實現方法進行了詳細的分析介紹,需要的朋友參考下
這是擴展yibing的select默認選擇的實現方法
復制代碼 代碼如下:
<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>
<option <?php if($myrow[wuyeleixing]==3) echo("selected");?> value="3">營業房</option>
<option <?php if($myrow[wuyeleixing]==4) echo("selected");?> value="4">廠房</option>
<option <?php if($myrow[wuyeleixing]==5) echo("selected");?> value="5">倉庫</option>
<option <?php if($myrow[wuyeleixing]==6) echo("selected");?> value="6">地塊</option>
<option <?php if($myrow[wuyeleixing]==7) echo("selected");?> value="7">綜合樓</option>
<option <?php if($myrow[wuyeleixing]==8) echo("selected");?> value="8">農牧場</option>
<option <?php if($myrow[wuyeleixing]==9) echo("selected");?> value="9">商住樓</option>
<option <?php if($myrow[wuyeleixing]==10) echo("selected");?> value="10">賓館酒樓</option>
<option <?php if($myrow[wuyeleixing]==11) echo("selected");?> value="11">校捨</option>
</select>
radio單選框的默認選擇實現
復制代碼 代碼如下:
<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");?>>出讓
<input type="radio" name="dishu" value="2" <?php if($myrow[dishu]==2) echo("checked");?>>劃撥
<input type="radio" name="dishu" value="4" <?php if($myrow[dishu]==4) echo("checked");?>>集體
checkbox 復選框的默認選擇實現
復制代碼 代碼如下:
<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>
<td width="96" height="1"><strong><font color="#008080" face="楷體_GB2312"><input
name="fujia_woju" type="checkbox" value="woju" <?php if($myrow[fujia_woju]) echo("checked");?>></font></strong>臥 具</td>
<td width="99" height="1"><strong><font color="#008080" face="楷體_GB2312"><input
name="fujia_TV" type="checkbox" value="TV" <?php if($myrow[fujia_TV]) echo("checked");?>></font></strong>電視機