Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
成功联系PHP后将用户重定向回原始站点_Php_Redirect_Contact Form - Fatal编程技术网

成功联系PHP后将用户重定向回原始站点

成功联系PHP后将用户重定向回原始站点,php,redirect,contact-form,Php,Redirect,Contact Form,在客户成功输入联系信息后,我尝试将他们重定向回我的原始主页。我将如何使用下面的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']

在客户成功输入联系信息后,我尝试将他们重定向回我的原始主页。我将如何使用下面的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函数 //检查电子邮件是否已发送

if($send_email)
{
   header('location:youwebsitehomepahe.php');
}
 else
{
   echo "E-mail sent was failed !";
}
还有一些类似的帖子你可以参考


谢谢,我试试看!谢谢你的帮助!