这是我在视图中的复选框值:
$data = array(
'name' => 'gejala[]',
'value' => $row->id_gejala.",".$row->id_penyakit,
'checked' => FALSE,
'style' => 'margin:10px',
);
接下来这是我的控制器:
function step2(){
$a = implode(',',$this->input->post('gejala'));
$break = explode(',',$a);
$data = array(
'id_gejala'=> $break[0],
'id_penyakit'=>$break[1]
);
foreach($data as $penyakit){
$data[] = array('id_gejala'=> $break[0],'id_penyakit'=>$break[1]);
}
print_r($data);
}
我的浏览器中的示例结果:
Array ( [id_gejala] => 58 [id_penyakit] => 6 )
我的问题,如何将结果插入数据库?也许它看起来像这里:
++++++++++++++++++++++++++++
id + id_gejala + id_penyakit
++++++++++++++++++++++++++++
1 + 58 + 6 +