我正在使用選擇下拉列表中的多個選擇,我想將其存儲在數據庫中。implode爆炸codeigniter中的數據
我聽說過內爆爆炸,但我不知道如何使用它們。請給我一個想法如何在codeigniter中爆炸和爆炸。
我的HTML表單:
<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>
我的控制器:
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);
}
查看文件:
<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>
您應該將ID存儲中 - OID組合在一個單獨的表。這樣你可以在將來搜索和過濾。 – jeroen
好的,我可以保存,但我的主要問題是我想保存多個值在我的數據庫中的一列,並顯示他們在視圖中...我怎麼能實現? –