我有一个脚本,它搜索数据库并显示其上司要标记其出勤的用户列表。主管标记考勤并填写备注并提交表格。
我可以在 mysql 数据库中插入考勤,但备注栏没有更新。
请指导。
表单脚本
<td id="present">
<input type="radio" name="present[<? echo $rows['id']; ?>]" checked="checked" value="P">P
</td>
<td id="absent">
<input type="radio" name="present[<? echo $rows['id']; ?>]" value="A">A
</td>
<td id="tour">
<input type="radio" name="present[<? echo $rows['id']; ?>]" value="T">T
</td>
<td id="leave">
<input type="radio" name="present[<? echo $rows['id']; ?>]" value="L">L
</td>
</td>
<td id="hpl">
<input type="radio" name="present[<? echo $rows['id']; ?>]" value="H">H
</td>
<td width="30%" id="remark">
<input type="text" name="remark[]" />
</td>
</tr>
<?php }?>
<?php }?>
<tr>
<td colspan="7" style="vertical-align:middle; text-align: center;"><br><br>
<input id="Submit" type="submit" name="Submit" value="Mark Attendance" style="text- align: center; background-color: #000000; color: #ffffff; border: 1px #000000 solid;">
</td>
和mysql更新脚本
foreach($_POST['present'] as $id => $value)
{
$getSets = mysql_query("SELECT * FROM users WHERE id='".$id."'");
$ausers = mysql_fetch_array($getSets);
$class=$ausers['user'];
$section=$ausers['email'];
$branch=$ausers['branch'];
$date1=$_POST['date'];
$date = date("Y-m-d", strtotime($date1));
$sql = "INSERT INTO statistics(user, wquestions, date, att, marker, branch, remark) VALUES ('$class', '$section', '$date', '".$value."','".USERNAME."', '$branch', '".$remark."') ";
$result = mysql_query($sql);