【发布时间】:2016-09-04 05:44:16
【问题描述】:
如果返回值匹配,如何选中复选框,否则取消选中复选框。
返回数组:
大批 ( [0] => 数组 ( [Property_Name] => LMS 取消链接客户 ) [1] => 数组 ( [Property_Name] => LMS 通知 ) )<th style="text-align: center;"><input type="checkbox" class="flat" <?php if($getlmsprivileges['Property_Name'] == 'LMS Reward'){ ?> checked <?php } ?> name="Reward"></th>
<td style="text-align: center;"><input type="checkbox" class="flat" <?php if($getlmsprivileges['Property_Name'] == 'LMS Promotion'){ ?> checked <?php } ?> name="Promotion"></td>
<td style="text-align: center;"><input type="checkbox" class="flat" <?php if($getlmsprivileges['Property_Name'] == 'LMS VAS'){ ?> checked <?php } ?> name="VAS"></td>
<td style="text-align: center;"><input type="checkbox" class="flat" <?php if($getlmsprivileges['Property_Name'] == 'LMS Unlink Customer'){ ?> checked <?php } ?> name="Unlink_Customer"></td>
<td style="text-align: center;"><input type="checkbox" class="flat" <?php if($getlmsprivileges['Property_Name'] == 'LMS Notification'){ ?> checked <?php } ?> name="Notification"></td>
【问题讨论】:
-
您显示的代码中没有
LMS Notification值 -
您的复选框名称是单一的..那么您如何期望数组具有键“Property_Name”?这几乎没有任何意义。
-
一开始你忽略了解释你是如何得到这个数组的。您期望此代码执行的操作与您的数组结构之间存在脱节。所以问题一定在于数组是如何生成的。
-
我在 yii queryAll 结果的返回值上得到了这个数组格式
标签: php html arrays multidimensional-array