0
我想从列表中选中复选框。 我越来越差错/警告在cakephp中显示选中的复选框
参数1不是一个字符串(for for循环)。
的复选框具有ID
场,所以当一个复选框被选中,我只是想获得这个ID
该行称为checkid
的。
我似乎无法一次遍历列表中的一个,也检查已检查的字段。
我已经尝试了各种组合,我不知道确切的方法。
我没有在这里找到它 http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html
控制器
if (isset($this->request->data['addrecord'])) {
foreach ($this->request->data as $key => $item):
if (isset($item['checkid'])){
if ($item['checkid']>0){
// $lessonId=($item['id']);
debug($item['checkid']); //no output
}
}
endforeach;
view//
echo '<td>'.$this->Form->checkbox('User.'.$key.'.checkid',
array('value'=>$student['Student']['id'], 'checked'=>0)).'</td>';
输出,我不能让个别checkid
array(
'addrecord' => 'Add Email(s)',
'User' => array(
'firstname' => 'a',
'lastname' => '',
'searchemail' => '',
'id' => '372',
(int) 0 => array(
'checkid' => '216'
),
(int) 1 => array(
'checkid' => '311'
),
(int) 2 => array(
'checkid' => '0'
),
(int) 3 => array(
'checkid' => '0'