我正在尝试将客户成功输入其联系信息后重定向回原来的主页。我将如何使用以下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 !";
}
?>
答案 0 :(得分:1)
要重定向,您可以使用:
header("Location: yourpage.php");
重定向到您想要的页面
答案 1 :(得分:0)
只需使用php的header功能即可 //检查电子邮件是否已发送
if($send_email)
{
header('location:youwebsitehomepahe.php');
}
else
{
echo "E-mail sent was failed !";
}
您可以参考其他类似的帖子