我正在实现一个会议记录表格,其中学生和主管之间的会议记录保存在一个名为“minute.php”的数据库表中。当学生添加分钟时,他们需要输入一些数据,但需要禁用某些字段,只有主管才能输入。但是,当我禁用文本框时,它会抛出一个错误,即该字段不能为空,因为数据库正在期待某些东西......
另外,我已经预先填写了两个字段(Bnumber 和 Status),但是当出现“添加分钟”表单时,这些字段没有预先填写,有人知道如何处理吗?
<?php
include ("dbConnect.php");
include ("studenthead.php");
session_start();
if (!(isset($_SESSION["sess_username"]))) header ("Location: index.php");
$currentUser=$_SESSION["sess_username"];
if (isset($_POST['addMinute'])) {
$newB_number = $currentUser;
$newDate = $_POST['Date'];
$newTime = $_POST['Time'];
$newDiscussion = $_POST['Discussion'];
$newActions = $_POST['Actions'];
$newDateofnextmeeting = $_POST['Dateofnextmeeting'];
$newStatus = "Submitted";
$newSupervisor_comments = $_POST['Supervisor_comments'];
$dbQuery = $db->prepare("insert into minute values (null, :newB_number, :newDate, :newTime, :newDiscussion, :newActions, :newDateofnextmeeting, :newStatus, :newSupervisor_comments )");
$dbParams = array('$newB_number'=>$newB_number, 'newDate'=>$newDate, 'newTime'=>$newTime, 'newDiscussion'=>$newDiscussion, 'newActions'=>$newActions, 'newDateofnextmeeting'=>$newDateofnextmeeting, 'newStatus'=>$newStatus, 'newSupervisor_comments'=>$newSupervisor_comments);
$dbQuery->execute($dbParams);
$lastInserted = $db->lastInsertId();
}
?>