今天的困境是php的形式。然而,这个'send_contact'脚本确实是非常基本的东西,而不是简单地回显消息。我们想回显或重定向到一个可爱的样式html页面。
<?php
// Contact Subject
$fullname = $_POST["full_name"];
// Details
$businessname = $_POST["business_name"];
$addressline1 = $_POST["address_line_1"];
//HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// Mail of Sender
$mail_from = $_POST["email_addr"];
//From
$headers .="from: <".$mail_from.">";
//Enter your email address
$to ="mywifelovesphp@php.co.uk";
$subject = "Catalogue Request - ".date("d/m/Y");
$message = "<html> <body>";
$message .= "<h3>".$businessname."</h3>\r\n";
$message .= $fullname."\r\n";
$message .= $addressline1."\r\n";
$message .= "</body></html>";
$send_contact=mail($to,$subject,$message,$headers);
//Check, if message sent to your email
//display message "We've recieved your information"
if($send_contact)
{echo "We've recieved your information";
}
else {
echo "Error";
}
?>