각 출석에 대한 체크 박스가 포함 된 학생 출석 테이블을 만들려고합니다. 즉, 데이터베이스에 저장됩니다.다중 체크 박스 만들기 PHP
이것은 내가 지금까지 가지고있는 테이블이며, ajax 함수 호출에서 실행됩니다. 대부분의 데이터는 학생 이름이 포함 된 데이터베이스에서 가져온 것입니다. 이 예 checkAttend.php
에서 $numStudent = 5;
echo '<form method="post" action="checkAttend.php">
<table border="1">';
$count = 1;
while(($count < $numStudent) && ($students = mysqli_fetch_assoc($result))) {
echo '<tr>
<th>' . $count. '</th>
<th>' . $students['student_name'] . '</th>
<th> <input type="checkbox" name="students[]" /> </th>
</tr>';
$count++;
}
echo '<th colspan = "3">
<input type="submit" name="button" id="button" value="Submit" /> </th>';
echo '</table>';
echo '</form>';
양식 인쇄 방식 그대로 I가 필요하지만 체크 박스 배열의 값을 출력 할 때 (값이 무엇인지 확인을 위해서
배열의 각 값을 출력합니다) 데이터베이스에 저장하기 전에 포함 : 학생이 결석인지 아닌지$student_attend[0] A
$student_attend[1] r
$student_attend[2] r
$student_attend[3] a
$student_attend[4] y
일반적으로 내가 나타 내기 위해 데이터베이스의 해당 필드 값의 어떤 종류를 저장할.
체크 박스 루프를 올바르게 수행하고 있는지 또는 더 많은 것들을 추가해야하는지 알 수 없습니다.