I am doing a project with code igniter in which i have a form that contains a list of students.My form is as follows:
<form action = 'my_controller/my_method' method = "post">
<table>
<thead>
<tr>
<th>Roll</th>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($students as $row) { ?>
<tr>
<td><?php echo $row->roll; ?></td>
<td><?php echo $row->name; ?></td>
<input type = "hidden" name = "class_id" value = "<?php echo $row->class_id; ?>" />
<input type = "hidden" name = "student_id" value = "<?php echo $row->student_id; ?>" />
<td><input type="submit" value="some value" class= "btn btn-info"></td>
</tr>
</tbody>
</table>
</form>
In my controller i need to get the hidden inputs. ie; class_id and student_id. class_id is same for all 's in the table. But student_id is varying. How can i get the student_ids in each form submit. Iam getting this class_id in my controller by $class_id = $this->input->post('class_id'); Thanks in advance. My controller method is
function my_method(){
$class_id = $this->input->post('class_id');
$student_id = $this->input->post('student_id');
echo $student_id;
}