2017-04-14 84 views
0

目前,我的编码会向PHP发送一个post命令,将数据推送到一封电子邮件。 我正在寻找一种方法来重新定向服务器发送电子邮件到URL后。如何在表单提交后重定向?

<?php 
$email_from = '[email protected]'; 
$email_subject = "New Form submission"; 
$email_body = "You have received a new insurance enquiry from $firstname $lastname $gender born on $dobday $dobmonth $dobyear $smoker is after $insurtype 
They want to cover $cover,000 for $years years for $meandpartner 

Contact information: 
Mobile: $mobile 
Telephone: $landline 
E-mail: $email 
Street: $street 
City: $city 
Postcode: $postcode 

Partner details: 
$pfirstname 
$plastname 
$pgender 
$pdobday $pdobmonth $pdobyear 
$psmoker 

" ?> 

<?php 
$to = "[email protected]"; 
$headers = "From: $email_from \r\n"; 
$headers .= "Reply-To: [email protected]"; 
mail($to,$email_subject,$email_body,$headers); 
?> 

回答

0

您可以使用头:这里

header('Location: mypage.php'); 

更多信息:http://php.net/manual/en/function.header.php

+0

谢谢,但我得到的错误: 警告:不能更改头信息 - 头已经发出(输出开始于/home/quotethemarket/public_html/slider/ionRangeSliderDemo/action_life_insurance.php:40)in/home/quotethemarket/public_html/slider/ionRangeSliderDemo/actio在线71 – Mike

+0

n_life_insurance.php谢谢,我错了,现在它工作! – Mike

0
submitform = name of form 

if (isset($_POST['submitform'])) 
{?> 
    <script type="text/javascript"> 
    window.location = "http://www.google.com/"; 
    </script> 
<?php }