如果选中,我无法将列更新为 yes。我没有收到任何错误。我究竟做错了什么?我尝试了多种方法,包括将数组保留在引号中和引号中。我知道如何通过带有电子邮件地址而不是复选框的表单来做到这一点。我也知道如何使用复选框从数据库中删除行。但是不更新...
<?php
$id = $_GET['id'];
$select = mysql_query("SELECT * FROM volsMain WHERE ID = '$id'");
$data = mysql_fetch_array($select);
?>
<?php
$query="SELECT * FROM volsMain ORDER BY shift_times, position";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)){
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="checkbox" name="checkinsat" value="yes"<?php
if($data['checkinsat'] == 'yes') echo 'checked'; ?>/>
<input type="submit" >
</form>
<?php
if ($row['saturday'] === 'A.M.') {
echo '<span class="amShift">';
} else if ($row['saturday'] === 'P.M.') {
echo '<span class="pmShift">';
} else {
echo '<span>';
}
echo "SATURDAY:" . $row['saturday'] . '</span><br />';
if ($row['sunday'] === 'A.M.') {
echo '<span class="amShift">';
} else if ($row['sunday'] === 'P.M.') {
echo '<span class="pmShift">';
} else {
echo '<span>';
}
echo "SUNDAY:". $row['sunday'] . '</span><br />';
echo "<br />SHIRT SIZE:<h2>" . $row['shirt'] . "</h2>";
echo "<br />VOLUNTEER NAME:<h2>" . $row['agreeName'] . "</h2>";
echo "<p>Assigned as a volunteer for:<br />" . $row['position'] . "</p>";
echo "<p>Shift times are scheduled for:<br />" . $row['shift_times'] . "</p>";
echo "<p>Shifts have been confirmed:<br />" . $row['confirmed'] . "</p>";
echo "<p>Checked in Friday:<br />" . $row['checkinfri'] . "</p>";
echo "<p>Checked in Saturday:<br />" . $row['checkinsat'] . "</p>";
echo "<p>Checked in Sunday:<br />" . $row['checkinsun'] . "</p>";
}
?>
<?php
$checkSAT = isset($_POST['checkinsat']) ? "yes" : "no";
$updateSat = mysql_query("UPDATE volsMain SET checkinsat = '$checkSAT' WHERE ID = '$id'");
$query = mysql_query($updateSat);
$result = mysql_query($query);
echo "<p>" . print_r($checkSAT) . "</p>";
?>