我想使用感谢联系警报框除了使用感谢you.html页面,请帮助我PHP代码为我初学者的PHP。请帮我。 代码在这里
<?php
if(!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
}
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$contact =$_POST['contact']
$message = $_POST['message'];
//Validate first
if(empty($name)||empty($visitor_email))
{
echo "Name and email are mandatory!";
exit;
}
if(IsInjected($visitor_email))
{
echo "Bad email value!";
exit;
}
$email_from = 'tom@amazing-designs.com';//<== update the email address
$email_subject = "New Form submission";
$email_body = "You have received a new message from the user $name.\n".
"Here is the message:\n $message".
$to = "tom@amazing-designs.com";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: thank-you.html');
请在重定向页面上帮助我我不想重定向我只是想表示感谢提醒请联系我们,请尽快帮助我
答案 0 :(得分:0)
删除标题(&#39;位置:thank-you.html&#39;);并添加javascript
<script>
alert('Thank you!!!');
</script>
答案 1 :(得分:0)
将header()
部分替换为:
printf("<script> alert('Thank You!'); </script>");