I am using multiple select from a select drop down and I want to store it in database.
I have heard about implode explode, but I have no idea how to use them. Please give me an idea how to implode and explode in codeigniter.
My HTML form:
<div class="form-group">
<label>
Please Select Proof Of ID Deposit
</label>
<select multiple="" name="oids" class="js-example-basic-multiple js-states form-control">
<optgroup>
<option value="Passport">Passport</option>
<option value="National ID Card">National ID Card</option>
<option value="Driving Licence">Driving Licence</option>
<option value="Univesity ID">Univesity ID</option>
</optgroup>
</select>
</div>
My controller:
public function customer_insert(){
$data = array(
'id'=>$this->input->post('up_id'),
'Other_id'=>$this->input->post('oids') //here I want to implode my values
)
$this->db->insert('customer', $data);
}
View file:
<table>
<thead>
<tr><td>ID</td></tr>
<tr><td>Other ID</td></tr>
</thead>
<?php foreach ($query as $customer){?>
<tr><td><?php echo $customer->id?></td></tr>
<tr><td><?php echo $customer->Other_id?></td></tr> // I want to show my imploded value here.
<?php}?>
</table>