0

在客户成功输入联系信息后,我正尝试将他们重定向回我的原始主页。我将如何使用以下 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 !";
}


?>
4

2 回答 2

1

要重定向,您可以使用:

header("Location: yourpage.php"); 

重定向到您想要的页面

于 2013-05-01T17:29:10.043 回答
0

只需使用php 的header函数 // 检查电子邮件是否已发送

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

还有一些类似的帖子可以参考

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

于 2013-05-01T17:30:16.133 回答