우선, 시간을 내주는 데 도움을 주신 것에 대해 미리 감사드립니다. 여러 라디오 버튼을 사용하여 학교에 출석 양식을 작성 중입니다. 학생과 클래스가 데이터베이스에 있으며 교사가 수업을 선택하면 클래스 7 을 말한 다음 클래스 7의 모든 학생 이름을 테이블의 목록으로 채 웁니다. 모든 학생 이름 옆에 세 개의 라디오 버튼이 있습니다. 그 가치는 Accepted, Not Accept, Tardy가 될 것입니다. 학생들을 포폴로 만들려면 다음과 같이 Java 함수를 사용합니다. 첫 페이지는 (W3school에서 찾을 수 있습니다.) 하자 말 populate.php라디오 버튼이있는 출석 시스템
두 번째 페이지가 users.php를 offcourse 및 다음과 같습니다됩니다 // 그리고<html>
<head>
<script type="text/javascript">
function showUser(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a class:</option>
<?php
getClasses();
?>
</select>
</form>
<br />
</body>
</html>
<?php
:
$q=$_GET["q"];
$sql = "SELECT s.firstname, s.lastname, s.student_id, s.class_id, cl.class_id ".
" FROM students s ".
" INNER JOIN classes cl ON cl.class_id = s.class_id ".
" WHERE s.class_id =$q ";
$result = mysql_query($sql);
print '<table border="2">'.
'<tr>'.
'<th>Firstname</th>'.
'<th>Lastname</th>'.
'<th>Kind of absence</th>'.
'</tr>';
while($row = mysql_fetch_array($result))
{
print '<tr>'.
'<td>'.$row['firstname'].'</td>'.
'<td>'. $row['lastname'] . '</td>'.
'<td>'.
'<form method="post" action="getuser.php">'.
'<input type="radio" name="attendance[]"
value="1">Accepted</input>'.
'<input type="radio" name="attendance[]" value="2"> Not
accepted</input>'.
'<input type="radio" name="attendance[]" value="3"> Tardy</input>'.
'</form>'.
'</td>'.
'</tr>';
}
print '<tr>'.
'<td>'.
'<form method="post" action="getuser.php">'.
'<input type="submit" name="submit" value="Send">  '.
'</form>'.
'</td>'.
가 // 내가 버튼을 제출 넣을 위치를 모른다 형태.
print '</table>';
// 라디오 버튼의 모든 값을 가져 와서 데이터베이스에 삽입하는 것입니다.
if (isset($_REQUEST['submit']) && $_REQUEST['submit'] != "") {
if(isset($_POST['attendance']))
{
$atendance = $_POST['attendance'];
for ($i=0; $i<sizeof($attendance);$i++) {
// 내가하지 어떻게하지만 난 아마 여기 배열에 너무 student_id의를 수집 알고
$sql2 = " INSERT INTO absence (student_id, attendans_id ) ".
" VALUES (".$student_id.", '".$attendance[$i]."') ";
mysql_query($sql2) or die(mysql_error());
}
}
}
// 그래서 사랑하는 PHP 애호가 ... 내가 totaly 잘못하고 알고 있지만 이 문제를 해결하는 방법을 모르겠다.
문제는 나를 도와 줄 수 있다면 정말 좋을 것이다. 다시 한번 감사드립니다. 모든 학생을 선택하는 세 개의 라디오 버튼이 있습니다. 내 말은 모든 이름 옆에 세 가지 대안이있을 것입니다 ... 가치가 인정되고 받아 들여지지 않는 모든 학생을위한 세 개의 라디오 버튼과 지각이 있습니다. ?>
편집 질문
여기 – freshnode