2013-12-08 18 views
0

我的PHP sendmailscript不工作,它發送的郵件,但它不重定向到給定的網址。PHP的sendmail不重定向到給定的網址?

<? 
session_start(); 
if ($_SERVER["REQUEST_METHOD"] <> "POST") 
die("You can only reach this page by posting from the html form"); 
if ($_POST["captcha_input"] == $_SESSION["pass"]) 
{ 
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; 
$mailuser = "[email protected]"; 
$url = "index.html"; 
$header = "Return-Path: ".$mailuser."\r\n"; 
$header .= "From: form with captcha <".$mailuser.">\r\n"; 
$header .= "Content-Type: text/html;"; 

$mail_body = ' 
<b>Name</b> : '. $_POST[Name] .'<br><br> 
<b>Email</b> : '. $_POST[Email] . '<br><br> 
<b>Mobile</b> : '. $_POST[Mobile] . '<br><br> 
<b>Unit Type</b> : '. $_POST[select] . '<br><br> 
<b>Comments</b> : '. $_POST[Query] . '<br>' 
; 
mail ($mailuser, 'Enquiry', $mail_body, $header); 
echo 'THANKS '; 
} else { 
echo "Sorry! you did not pass the Security Check.<br><br>"; 
echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again."; 
} 
?> 
+0

你後,你設置的URL的位置輸出,它 –

+0

其實我是新來的PHP,你能不能幫我變元? –

+0

切換這些行echo'';和$ url =「index.html」;所以你的變量在你輸出前設置 –

回答

0

請使用PHP的重定向頭。 對於PHP電子郵件教程,請檢查以下鏈接。

+0

其實我是新來的PHP。請更正代碼! –

+0

header('Location:http://www.example.com/'); –