My check boxes are created using a while loop, so i can't put id's or names on everyone of them, so i can't change the record. The check boxes are ticked if a value is 1 and not ticked if a value is 0 in my table, that's good for checking, but cant I use them to change the value of record corresponding to the check box? Here is my code:
<?php
if($records === FALSE) {
die(mysql_error());
}
while($student=mysql_fetch_assoc($records)){
echo "<tr>";
echo "<td>".$student['SID']."</td>";
echo "<td>".$student['Student_Name']."</td>";
if($student['Month_1'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_2'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_3'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_4'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_5'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_6'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_7'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_8'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_9'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_10'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_11'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
if($student['Month_12'] == 1){
echo "<td>"."<input type='checkbox' checked='true'>"."</td>";
}else{
echo "<td>"."<input type='checkbox' checked='false'>"."</td>";
}
echo "</tr>";
}
?>
Aucun commentaire:
Enregistrer un commentaire