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'