重定向用户回到原来的网站后,成功的联系形式PHP


Redirecting user back to original site after successful contact form PHP

我试图在客户成功输入联系信息后将他们重定向到我的原始主页。如何使用下面的PHP表单呢?提前感谢您的所有帮助!

<?php
// Receive form's subject value into php $subject variable
$subject =$_REQUEST['subject'];
// Receive form's message value into php $message variable
$message=$_REQUEST['message'];
// Receive form's sender name value into php $sender variable
$sender=$_REQUEST['name'];
// Receive form's user email value into php $user_email variable
$user_email=$_REQUEST['email'];
// the email address where the message will be sent
$TO ="ttdthemes@gmail.com";
$send_email=mail($TO,$subject,$message,"From: ".$sender."<".$user_email.">");
// To check email has been sent or not
if($send_email)
{
echo "Your E-mail has been sent !";
}
 else
{
echo "E-mail sent was failed !";
}

?>

可以使用:

header("Location: yourpage.php"); 

重定向到您想要的页面

使用php的header函数//查看邮件是否已发送

if($send_email)
{
   header('location:youwebsitehomepahe.php');
}
 else
{
   echo "E-mail sent was failed !";
}

有其他类似的帖子,你可以参考

如何重定向如果用户已经登录