I'm trying to insert all rows which showing view in a table but it insert only one row with value '1' not all rows and not that id's contain in a column:
view:
echo"<table class='table table-hover type-list2'id='traineeList'>
<tr class='success'>
<th>Trainee ID</th>
<th>Trainee Name</th>
<th>Present</th>
</tr>";
foreach($list['trainee'] as $row){
echo "
<tr><td>".str_pad($row->TraineeID,7,"0", STR_PAD_LEFT)."</td>
<td>".$row->Name."</td>
<td><input type='checkbox' name='.$row->TraineeID[]' value='".$row->TraineeID."' checked></td>
</tr>";
}
echo "</table>";
controller:
public function insertAttendance(){
$data = array('TraineeID'>=$this->input->post('TraineeID'));
$attnDate=$this->input->post('attnDate');
$classHour= $this->input->post('classHour');
foreach ($data as $id){
$query="INSERT INTO `tbl_attn_temp` (TraineeID, Date, classHour) VALUES ('".$id."','".$attnDate."','".$classHour."')";
$this->db->query($query);
redirect('attendance/index/');
}