我試圖通過選中下拉菜單中的複選框來更新學生類的列表。我選擇了四個複選框。因此,調試正確顯示248,268,244,1220。但由於「classroom_id」,我得到了一個錯誤Warning (2): Illegal string offset 'id' [APP/controllers/customers_controller.php, line 728]
。有沒有反正只顯示選定的複選框ID列表?cakephp 1.2多個更新複選框與下拉菜單
我試圖通過選擇複選框來更新多個記錄/行。我如何將多個選定的ID發送給控制器?
任何幫助將不勝感激。
<?php echo $form->input('classroom_id', array('type' => 'select','empty' => '-- Select --','label' => false,'style'=>'width:254px;', 'options' => $classesfiltered,'validate'=>'required:true','div'=>'formfield')); ?>
<?php foreach ($students as $student) { ?>
<?php echo $form->input('Customer.'.$student['Customer']['id'].'.id', array('type' => 'checkbox', 'id' => "admin_checkbox_".$student['Customer']['id'], 'label' => false)); ?>
<?php } ?>
控制器
foreach($this->data['Customer'] as $key => $item) {
if ($item['id']) {
Debugger::Dump($this->data['Customer'][$key]);
}
}
輸出
Warning (2): Illegal string offset 'id' [APP/controllers/customers_controller.php, line 728]
"classroom_id"
248
268
244
1220
你是明星! – DANLEE 2013-04-24 05:41:54