我正在一個靜態網站上工作,其中有一個聯繫我們頁面。這裏我想要做的是當聯繫表單被提交時,它應該顯示消息 - 電子郵件已成功發送。但問題是我打電話給html頁面,我們無法在html視圖中傳遞php消息。那麼有什麼辦法可以完成它。 conatctus.php在HTML頁面上顯示php msg
<?php
$error = '';
$mailTo = $_POST['email'];
$mailFrom = '[email protected]';
//$headers = 'MIME-Version: 1.0' . "\r\n";
//$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$fullname = $_POST['username'];
$phoneno = $_POST['mobile'];
$emailaddress = $_POST['email'];
$msgsubject =$_POST['message'];
$new = "\n";
$msg = $fullname.$new.$emailaddress.$new.$phoneno.$new.$msgsubject;
$to = $email;
$subject = 'Inquiry';
$messageclient = '<div>
<p>Thank you For Inquiry.</p>
<p> We will reach back to you shortly. Have a Nice Day!</p>
<p>Company © 2013</p>
</p></div>
';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Company<[email protected]>\r\n";
//$res = mail($to, $subject, $message, $headers);
//$message ='Thank you For Inquiry. We will reach back to you shortly. Have a Nice Day';
mail($mailTo , $subject, $messageclient, $headers);
$message .= "<p>Name: $fullname</p><br /><p>Contact Number : $phoneno</p><br /> <p>Email: $emailaddress</p><br /><p>Message: $msgsubject</p>";
mail($mailFrom, $subject,$message, $headers);
header("location:home.html");
?>
你的幫助是非常讚賞,謝謝提前。
難道你不能'回聲(...)'? – sircapsalot 2013-03-05 19:45:37