This is my checkbox value in view :
$data = array(
'name' => 'gejala[]',
'value' => $row->id_gejala.",".$row->id_penyakit,
'checked' => FALSE,
'style' => 'margin:10px',
);
and next this is my controller :
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);
}
Example result in my browser :
Array ( [id_gejala] => 58 [id_penyakit] => 6 )
My question, how to insert the result to database ? Maybe it look like here :
++++++++++++++++++++++++++++
id + id_gejala + id_penyakit
++++++++++++++++++++++++++++
1 + 58 + 6 +