我在网站上使用了具有完全相同配置的多个表单,但我特别面临此表单的问题。
源代码:
<?php
if (!$_POST['assessment-occupation'] || !$_POST['assessment-highest-qualification'] || !$_POST['assessment-experience']) {
echo "<p>Please supply all of the data!</p>";
exit;
} else {
require('db-connection.php');
//require('file-upload-script.php');
try {
session_start();
$stmt = $conn->prepare("UPDATE visa SET job_title= :assessment-occupation, Qualifications= :assessment-highest-qualification, experience= :assessment-experience, comments= :assessment-comments WHERE id= :id");
// escape variables for security
$stmt->bindParam(':assessment-occupation', $_POST['assessment-occupation']);
$stmt->bindParam(':assessment-highest-qualification', $_POST['assessment-highest-qualification']);
$stmt->bindParam(':assessment-experience', $_POST['assessment-experience']);
//$stmt->bindParam(':file_upload', $target_file);
$stmt->bindParam(':assessment-comments', $_POST['assessment-comments']);
$stmt->bindParam(':id', $_SESSION["regId"]);
$stmt->execute();
} catch (PDOException $e) {
echo $e->getMessage();
}
}