发送一半的邮件价值

时间:2019-04-10 13:00:03

标签: php

提交表单时,字段值以家庭住址开头。一半的字段值未发送。

邮件中未发送名字,姓氏,地区,电话,电子邮件。

<?php
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$area = $_POST["area"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$street1 = $_POST["street1"];
$street2 = $_POST["street2"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$new = $_POST["new"];
$email = $_POST["email"];
$already = $_POST["already"];
$time = $_POST["time"];

if($_POST["email"]){
    $ToEmail = 'info@example.com';
    $EmailSubject =' Example Title';
    $mailheader = "From: ".$_POST["email"]."\r\n";
    $mailheader .= "Reply-To: ".$_POST["email"];
    $MESSAGE_BODY .=' First Name : '.$fname."\r\n";
    $MESSAGE_BODY .=' Last Name : '.$lname."\r\n";
    $MESSAGE_BODY .=' Phone Number : '.$area.' '.$phone."\r\n";
    $MESSAGE_BODY .=' Email : '.$email."\r\n";
    $MESSAGE_BODY .=' Home Address : '.$street1.' '.$street2."\r\n";
    $MESSAGE_BODY .=' City : '.$city."\r\n";
    $MESSAGE_BODY .=' State : '.$state."\r\n";
    $MESSAGE_BODY .=' Zip : '.$zip."\r\n";
    $MESSAGE_BODY .=' Looking for new service : '.$new."\r\n";
    $MESSAGE_BODY .=' Already have service with another provider : '.$already."\r\n";
    $MESSAGE_BODY .=' Select the best time : '.$time."\r\n";


    $MESSAGE_BODY .= 'Service Interested in :'."\r\n";
    if (isset($_POST['servicelist']) && !empty($_POST['servicelist']))        {
        foreach($_POST['servicelist'] as $selected ){
            $MESSAGE_BODY .= $selected."\r\n";
        }
    }
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die     ("Failure");
    echo "Your message was sent";
    header("refresh:2; url:index.php");
}
else{
    echo "Sorry , No mail was sent";
}
?>

0 个答案:

没有答案