除了保持在同一页面上的成功消息外,我有以下表格有效。
我一直在绞尽脑汁,但在这一点上它是糊状的。
**问题我需要关闭表单并在提交表单时显示“成功”DIV。
现在我唯一能做的就是通过使用标题让它进入thanks.php 页面。
所有代码都在 jsfiddle:http: //jsfiddle.net/webs4me/hyArd/1/
除了下面的 send.hello.php: - 谢谢
<?php
// Clean up the input values
foreach($_POST as $key => $value) {
if(ini_get('magic_quotes_gpc'))
$_POST[$key] = stripslashes($_POST[$key]);
$_POST[$key] = htmlspecialchars(strip_tags($_POST[$key]));
}
// Honeypot don't send - THIS WILL BE HIDDEN LATER
if(!empty($_POST["confirm_email"])) {
header("location:spam.php");exit;
}
// Assign the input values to variables for easy reference
$name = $_POST["name"];
$email = $_POST["email"];
$confirm = $_POST["confirm_email"];
$phone = $_POST["phone"];
$message = $_POST["message"];
// Send the email *********** enter your email address and message info
$to = "myemail@myemail.com";
$subject = "Website message: $name";
$message = "From:\n$name\n\nEmail:\n$email\n\nPhone:\n$phone\n\nMessage:\n$message";
$headers = "From: $email";
mail($to, $subject, $message, $headers);
header('location: thanks.php');
?>