[eluser]wasconet[/eluser]
I am designing a school attendance script, views looks like this
Code:
<form acti echo base_url(); ?>teachers/attendance' method='post'>
<tr>
<thead>
<th class="first" width="10%">S/No.</th>
<th>Name</th>
<th>Present/Absent</th>
<th>Remark</th>
</thead>
</tr>
<?php
$x=1;
foreach($teachers as $teacher)
{$teacher_id=$teacher['teacherID'];
echo "<tr><td>".$x."</td>";
echo "<td>".$teacher['name']."</td>";
echo "<td><input type='checkbox' name='attendance[$teacher_id]' value='1'/></td>";
echo "<td><input type='text' name='remark[$teacher_id]'/></td></tr>";
$x++;
}
?>
<input type="submit" name="submit" value="send" />
</form>
when the submit button is clicked i get a data like this:
Code:
Array
(
[attendance] => Array
(
[1] => 1
[2] => 1
[3] => 0
[4] => 1
[5] => 1
[6] => 0
[7] => 0
[8] => 1
)
[remark] => Array
(
[1] =>
[2] =>
[3] => 'sick'
[4] =>
[5] =>
[6] => 'leave'
[7] => 'On assignment'
[8] =>
)
The table i want to insert it to looks like this:
teachers table
teacher_id, date, status, remark.
i want to kknow how i can insert the above data into this table.
Thanks...
NOTE: i limited the number of teachers to 8 just for illustration, also omitted the date which will be CURDATE(), the I to 8 are the teachers ID (teacher_id)