employer_rgn.php如何插入多个复选框值连续排在MySQL笨
<div class="form-group">
<label for="" class="control-label col-xs-2">
<?php echo $this->lang->line('spclzd_ctgry'); ?>
</label>
<div class=" col-md-8">
<input type="checkbox" name="spec_cat[]" value="Information Technology"> Information Technology
<input type="checkbox" name="spec_cat[]" value="Engineering/Manufacturing">Engineering/Manufacturing <br />
<input type="checkbox" name="spec_cat[]" value="Banking & Financial Services"> Banking & Financial Services
<input type="checkbox" name="spec_cat[]" value="BPO/ITES"> BPO/ITES <br />
<input type="checkbox" name="spec_cat[]" value="FMCG/Retail"> FMCG/Retail
<input type="checkbox" name="spec_cat[]" value="Telecom/ISP"> Telecom/ISP <br />
<input type="checkbox" name="spec_cat[]" value="Pharmaceuticals/Health Care"> Pharmaceuticals/Health Care
<input type="checkbox" name="spec_cat[]" value="Sales & Marketing"> Sales & Marketing <br />
<input type="checkbox" name="spec_cat[]" value="Other Non IT"> Other Non IT
</div>
</div>
employer_model
public function insert()
{
//Insert second stage details for employer into database.
$Specilized_category = $this->input->post('spec_cat');
$data=array('Specilized_category'=>implode(",", $Specilized_category),);
$this->db->insert('tbl_employer', $data);
我将复选框值成用逗号分隔的数据库。但问题是,我需要从数据库中取回选中的值以编辑我的代码。我如何使用implode方法得到这些值?或者是否必须更改我的代码以将值插入数据库?
你可以简单地在PHP中使用 –