i the check box list from another database table into my form and now i have to add database in my registration table with selected check box values. on submitting form the database only show the last check box values's id.
I call plan task form different table. i want to show the checked task in my inserting data.
this is the insert Model.
public function vedding_plan_add()
{
$data = array(
'vedd_title' => $this->input->post('vedd_title'),
'vedd_price' => $this->input->post('vedd_price'),
'vedd_desc' => $this->input->post('vedd_desc'),
'vedd_task_id' => $this->input->post('vedd_task_id')
);
$this->db->insert('vedd_plan',$data);
return;
}
this is my controller
public function plan_add()
{
$this->m->vedding_plan_add('$data');
$this->index();
}
and this is the view
<?php echo form_open('Plan_model/plan_add'); ?>
<p>
<lable for="vedd_title">Plan Title:</lable>
<input type="text" name="vedd_title" id="vedd_title" />
</p>
<p>
<lable for="vedd_price">Plan Price:</lable>
<input type="text" name="vedd_price" id="vedd_price" />
</p>
<p>
<lable for="vedd_desc">Plan Description:</lable>
<input type="text" name="vedd_desc" id="vedd_desc" />
</p>
<p>
<lable>Select Task:</lable>
<?php if(isset($records_task)) : foreach ($records_task as $row) { ?>
<input type="checkbox" name="vedd_task_id" value="<?=$row->vedd_task_id?>"><?=$row->task_name?><br>
<?php } ?>
<?php else: ?>
<?php endif; ?>
</p>
<input type="submit" value="submit" />
<?php echo form_close(); ?>
Aucun commentaire:
Enregistrer un commentaire