我在 PHP 中创建了一个联系表单。该表单工作正常并发送消息,但是当我尝试将用户重定向到我的感谢页面时,我收到了一个标题已经发送的消息。
我的表格开始:
<form name="myform" id="myform" class="form-foot" action="/receiving.php" method="post">
接收.php 的 PHP 代码是:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if(isset($_POST['submit']))
{
$from_add = "mysite@mysite.com";
$to_add = "mysite@mysite.com";
$subject = "Contact Form";
$message = "
Name:$name \n
Email: $email \n
Message: $message \n
$headers = "From: $from_add \r\n";
$headers .= "Reply-To: $from_add \r\n";
$headers .= "Return-Path: $from_add\r\n";
$headers .= "X-Mailer: PHP \r\n";
if(mail($to_add,$subject,$message,$headers))
{
Header("Location: /thanks");
}
}
?>
提交成功后如何将用户重定向到 www.mysite.com/thanks?