I have a form consist of multiple checkbox and input fields, I want to insert that data into a single column of a table, here is my form:
<div id="container">
<h1>property Detail</h1>
<form action="" method="post">
<table>
<tr>
<td>
Possesion
<input type="checkbox" name="feature[]" value="possesion">
</td>
<td>
Possesion1
<input type="checkbox" name="feature" value="possesion1">
</td>
<td>
Possesion2
<input type="checkbox" name="feature" value="possesion2">
</td>
<td>
Possesion3
<input type="checkbox" name="feature" value="possesion3">
</td>
<td>
Possesion4
<input type="checkbox" name="feature" value="possesion4">
</td>
</td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="submit"></td>
</tr>
</table>
</form>
</div>
here is my controller:
function index(){
$this->load->view('form');
if($_POST){
$data_feature = array (
'feature' => $_POST['feature']
);
$data['var']= $this->Mdata->p_detail($data_feature);
}
}
and here is my model:
function p_detail($data_feature){
$this->db->insert('feature',$data_feature);
return $this->db->insert_id();
}
I am getting only one feature value in my table, I want to get all the values of check boxes which user checked.
Regards