除非勾选复选框,否则我的表单无法提交,我真的不确定这是为什么。
此外,如果选中该复选框,则无法更新数据库,则我正在使用的功能或查询没有问题,因为我已直接在数据库上检查过。
任何帮助将不胜感激,如果我可以提供更多信息,请随时提出任何问题
<?php
include 'core/init.php';
protect_page();
include 'includes/overall/header.php';
$page = $_GET['page'];
$email = $_GET['user'];
$p_id = project_id_from_project_name($page);
$supervisor = supervisor_from_email($email, $p_id);
$user_id = user_id_from_email($email);
?>
<h1>Add A User to the Project</h1>
<?php
if (isset($_GET['form_submit']) === true && empty($_GET['form_submit']) === false) {
echo 'You\'re user has been added successfully!<br /><br />';
echo '<a href="projects.php">Please click here to return to Your Projects</a>';
} else {
if (empty($_POST) === false && empty($errors) === true) {
$page = $_GET['page'];
$p_id = project_id_from_project_name($page);
$supervisor_update = ($_POST['supervisor'] == 1) ? 1 : 0;
$update_project_member_data = array(
'project_id' => "$p_id",
'project_name' => "$page",
'project_member_id' => "$user_id",
'supervisor' => "$supervisor_update"
);
update_project_member_data($p_id, $update_project_member_data);
header('Location: update_user.php?page=' . $page .'&user=' . $email .'&form_submit=1');
exit();
} else if (empty($errors) === false) {
echo output_errors($errors);
}
?>
<form action="" method="post">
<ul>
<li>
Email Address: <?php echo $email ?>
</li>
<li>
Set user as Supervisor?<br />
<input name="supervisor" type="checkbox" <?php if ($supervisor == 1) {?> checked="checked"<?php }?>/>
</li>
<li>
<input type="submit" value="Update User">
</li>
</ul>
</form>
<?php
}
include 'includes/overall/footer.php'; ?>