2016-10-10 72 views
0

我继承了一个使用会话和MySQL的PHP​​表单,该表单使用了一个无线电元素,该元素应该检查当前无线电值是哪个值,并将其标记为“已选中”以填充根据数据库中的记录校正无线电元素。所有其他表单元素都可以正确填充,只是这个单选元素没有根据数据库值0或1进行检查。PHP isset不会填充表单中的无线电元素

这里是代码,我似乎缺少一些东西?

<label class="radioSublabel_Narrow" for="User_Update_group_4_Accepted__1"> Yes&nbsp; 
<input type="radio" name="User_Update_group_4_Accepted" id="User_Update_group_4_Accepted__1" value="1" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("userupdate","User_Update_group_4_Accepted"):""),"1"))) {echo "checked=\"checked\"";} ?> tabindex="4" title="Please enter a value."> 
</label> 
<label class="radioSublabel_Narrow" for="User_Update_group_4_Accepted__2"> No&nbsp; 
<input type="radio" name="User_Update_group_4_Accepted" id="User_Update_group_4_Accepted__2" value="0" class="formRadioField_Standard" <?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("userupdate","User_Update_group_4_Accepted"):""),"0"))) {echo "checked=\"checked\"";} ?> tabindex="5"> 
</label> 
+0

从我看到的我认为':'列是在错误的地方坑是你的代码显示任何错误? –

+1

为什么使用'strcmp()'而不是仅仅比较'=='? – Barmar

+0

是否设置了$ _GET ['invalid']? – Barmar

回答

0

输入元素缺少实际的数据库列引用:

$ row_SecurityAssistMSFields [“接受”]

这里是少了什么的代码的其余部分的情况下:

<?php if (!(strcmp((isset($_GET["invalid"])?ValidatedField("userupdate","User_Update_group_4_Accepted"):"".$row_SecurityAssistMSFields["Accepted"] .""),"this"))) {echo "checked=\"checked\"";} ?> tabindex="4" title="Please enter a value.">