我正在尝试添加一条消息,在邮件发送后显示消息已成功分派,但我不知道如何将其插入PHP请求部分。我预先烘焙了html但我无法链接它。我应该参与JQuery吗?
if ($conn->connect_error) {
array_push($errors, "We are having problems at the moment. PLease try again later");
}
if (empty($errors)) {
// prepare mysql query and bind variables
$query = "INSERT INTO contact_requests (firstname, lastname, email, company, requested_services, `message`)
VALUES (?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($query);
if (!$stmt) {
array_push($errors, "We are having problems at the moment. PLease try again later");
}
}
if (empty($errors)) {
if(!$stmt->bind_param("ssssss", $name, $last_name, $email, $company, $services, $message)) {
array_push($errors, "We are having problems at the moment. PLease try again later");
}
}
if (empty($errors)) {
if(!$stmt->execute()) {
array_push($errors, "We are having problems at the moment. PLease try again later");
}
}
}
function sanitize_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
HTML
<div id="success_message" style="width:100%; height:100%; display:none;">
<h3>Sent your message successfully!</h3>
</div>