[eluser]Ignis Avis[/eluser]
In the form input doing it like following
Code:
<?php foreach($fee_cat as $row) { ?>
<label><?php echo $row['fc_name']; ?></label>
<span class="field"><input type="checkbox" name="fc_id[]" value="<?php echo $row['fc_id']; ?>" /</span>
<?php } ?>
In the model
Code:
public function add_new_grade() {
$gt_name = $this->input->post('gt_name');
$gt_fee = $this->input->post('gt_fee');
$fc_id = $this->input->post('fc_id');
$data_to_store = array(
'gt_name' => $gt_name,
'gt_fee' => $gt_fee,
);
$this->db->insert('grade_table', $data_to_store);
$id = $this->db->insert_id();
$this->tableTag($fc_id,$id);
}
function tableTag($theData, $itemID) {
foreach ($theData as $d) {
$data_to_store = array(
'gf_fc_id' => $d,
'gf_gt_id' => $itemID
);
$this->db->insert('grade_fee', $data_to_store);
}
}
Its causing an array to string convertion error. What I am doing wrong? Thanks in advance.