Reputation: 83
I am new to codeigniter and facing problem in getting the id of a button from my view to the model. I am looping through buttons and the name of every button is coming from database which is unique for each iteration. how could i recognize the button in my model? This is the code for my VIEW..
foreach($detail1 as $object)
{
input type='submit' class='btn' name='$object->p_id' value='VIEW'
}
When I want to retrieve the Id of a button in model i do like..
$abc = $this->input->post('??? what to do inside?');
Please help me out..
Upvotes: 1
Views: 867
Reputation: 31739
You can use input arrays -
name='ids[<?php echo $object->p_id;]'
And in model -
$abc_ids = $this->input->post('ids');
$abc_ids
will be the array of id
s
Upvotes: 1