我的代码是
<div class="data" style="margin-top:15px;">
<div class="label1">Accreditation By:</div>
<div style="text-align:right;width:65px;float:left;">
<label for="a">COFRAC</label><input type="checkbox" name="accreditation_cofrac" value="cofrac" id="a" ></div>
<div class="label2" >
<label for="b">NABL</label><input type="checkbox" name="accreditation_nabl" value="nabl" id="b" >
</div>
</div>
如何编辑php中的这些复选框值
答案 0 :(得分:0)
您可以像
一样动态更改<input type="checkbox" name="accreditation_nabl" value="<?php if(isset($dynamicvar)){echo $dynamicvar;}else {echo 'nabl';}?>" id="b" >
$dynamicvar
(将是您想要改变的价值)
答案 1 :(得分:0)
我现在使用此代码确定..
<div class="data" style="margin-top:15px;">
<div class="label1">Accreditation By:</div>
<div style="text-align:right;width:65px;float:left;">
<label for="a">COFRAC</label><input type="checkbox" name="accreditation_cofrac" value="cofrac" <?php
$is_checked=$row['ACCREDITATION_BY'];
if(($is_checked=="cofrac") || ($is_checked=="cofrac nabl") )
echo $is_checked ? "checked" : " "
?>
id="a" /> </div>
<div class="label2" >
<label for="b">NABL</label><input type="checkbox" name="accreditation_nabl" value="nabl" <?php
$is_checked=$row['ACCREDITATION_BY'];
if(($is_checked=="nabl")|| ($is_checked=="cofrac nabl") )
echo $is_checked ? "checked" : " "
?> id="b" />
</div>
</div>