我已经在PHP中创建了一个联系表单。表单工作正常,并发送消息,但当我尝试将用户重定向到我的谢谢页面时,我收到一个头文件已发送消息。提交后重定向表单感谢页面
我开始形式:
<form name="myform" id="myform" class="form-foot" action="/receiving.php" method="post">
而对于receiving.php的PHP代码:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if(isset($_POST['submit']))
{
$from_add = "[email protected]";
$to_add = "[email protected]";
$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?
下面是解http://stackoverflow.com/questions/4459204/seeing-cannot-modify-header-information-error-when-attempting-to-redirect – Kevin
当你去完成通过重复你可能想要读一些关于头部注入的主题 – PeeHaa