我正在尝试使用 codeigniter 制作一个学校出勤跟踪器。我不知道如何让 Student_no 和单选按钮值 Present 或 Absent 进入数据库。student_no 和单选按钮的值都作为 NULL 发布到我的控制器?
我的控制器文件
function insertAttendance(){
$student_no=$this->input->post('student_no');
$attendance=$this->input->post('attendance');
$data = array(
'student_no'=>$student_no,
'attendance'=>$attendance
);
//$this->form_validation->set_data($data);
$this->db->set($data);
$this->db->insert('attendance',$data);
}
我的观点
<h3>ATTENDANCE TRACKER</h3>
<table class="table table-lg" name="student_no">
<tr>
<th>Student_NO</th>
<th>Student name</th>
<th>Student DOB</th>
<th>Attendance</th>
</tr>
<?php foreach ($query->result_array() as $row): {?>
<tr>
<td><?php echo $row['student_no'];?></td>
<td><?php echo $row['student_name'];?></td>
<td><?php echo $row['student_dob'];?></td>
<tr>
<label>
<label><input type="radio" name="attendance[<?php echo $row['player_id']; ?>]" value="Yes">Present</label>
 
<label><input type="radio" name="attendance[<?php echo $row['player_id']; ?>]" value="No">Absent</label>
</td> </tr>
<?php } ?>
<?php endforeach; ?>
</tr>
</tbody>
</table>