我有一个表单操作脚本。我一直在努力寻找这个问题。我的插页有问题,我找不到。
我错过了什么。当我运行脚本时,我收到HTTP 500错误
PHP
//prepare sql and bind parameters for to insert child data
$stmt2 = $conn->prepare("INSERT INTO `Child`(`fullnames`, `idnr`, `date_of_birth`, `School`) VALUES (:Fullname, :IDNR, :DateofBirth, (SELECT `school_id` FROM `Schools` WHERE `School` = :School) )");
$stmt2->bindParam(':Fullname', $fullname);
$stmt2->bindParam(':IDNR', $idnr);
$stmt2->bindParam(':DateofBirth', $dob);
$stmt2->bindParam(':School', $school);
// insert a row - child
$fullname = $_POST['name'];
$idnr = $_POST['idnr'];
$dob = $_POST['dob'];
$school = $_POST['school'];
$stmt2->execute();
HTML
<form action="insert_child_profile.php">
<div class="section"><span>1</span>Child's Basic detail</div>
<div class="inner-wrap">
<label>Full Name <input type="text" name="name" required /></label>
<label>ID Number <input type="text" name="idnr" required /></label>
<label>Date Of Birth <input type="text" name="dob" required/></label>
</div>
<div class="section"><span>2</span>School</div>
<div class="inner-wrap">
<div class="ui-widget">
<label>What school does the child attend<input type="text" name="school" id="school" class="form-control" required placeholder="Enter school Name"/></label>
<div id="schoollist"></div>
</div>
<br>
<br>
<br>
<br>
<div class="button-section">
<input type="submit" name="Sign Up" />
</div>
</div>
</form>