โค้ด: เลือกทั้งหมด
<?
$to = $_REQUEST['[email protected]'];
$from = $_REQUEST['Email'];
$name = $_REQUEST['Name'];
$headers = "From: $from";
$subject = "Panorama-condo Web site enquiry";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"City"} = "City";
$fields{"Phone"} = "Phone";
$fields{"Country"} = "Country";
$fields{"Comments"} = "Comments";
$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: [email protected]";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us.";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.panorama-condo.com.html" );}
else
{print "We encountered an error sending your mail, please notify [email protected]"; }
}
}
?>