드롭 다운 메뉴에서 선택 항목으로 체크 박스를 선택하여 학생 클래스 목록을 업데이트하려고했습니다. 4 개의 체크 박스를 선택했습니다. 따라서 디버그 올바르게 248,268,244,1220 보여줍니다. 하지만 "classroom_id"로 인해 Warning (2): Illegal string offset 'id' [APP/controllers/customers_controller.php, line 728]
오류가 발생했습니다. 어쨌든 선택된 체크 박스의 목록 만 표시하고 있습니까?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 } ?>
CONTROLLER
foreach($this->data['Customer'] as $key => $item) {
if ($item['id']) {
Debugger::Dump($this->data['Customer'][$key]);
}
}
OUTPUT
Warning (2): Illegal string offset 'id' [APP/controllers/customers_controller.php, line 728]
"classroom_id"
248
268
244
1220
당신은 스타입니다! – DANLEE