发送邮件php

发送邮件php,php,email,Php,Email,嘿,不知道为什么这个sint工作,但是消息以0的形式发送。我认为是电子邮件字段导致了这种情况 <?php if ($_POST['check'] == 'checked'){ header("location: /nospamplease.html"); exit(); } $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $date = $_PO

嘿,不知道为什么这个sint工作,但是消息以0的形式发送。我认为是电子邮件字段导致了这种情况

    <?php
if ($_POST['check'] == 'checked'){
        header("location: /nospamplease.html");
        exit();
}

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$date = $_POST['date'];
$children = $_POST['children'];
$hot = $_POST['hot'];
$comments = $_POST['comments'];

/*echo $name;
echo $email;
echo $phone;
echo $date;
echo $children;
echo $hot;
echo $comments;*/

if($name == "" || $email == "" || $phone == "" || $date == "" || $children == "" || $hot == "" || $comments == ""){
    echo "Please ensure all fields were filled out!";
    exit();
}else{
    $to = "######";
    $subject = "Birthday enquiry";
    $message = "Name: ".$name;
    $message += "Email: ".$email;
    $message += "Phone: ".$phone;
    $message += "Date: ".$date;
    $message += "Children: ".$children;
    $message += "Hot or cold: ".$hot;
    $message += "Comments: ".$comments;
    //echo $message;
    if(mail($to, $subject, $message)){
        echo "Thank you for your enquiry, we will contact you within the next 24 hours! <br /> Click <a href='###'> here</a> to go back to the website!";
    }else{
        echo "There was an error, contact us directly: <a href='mailto:##'>email</a>";
    }
}
?>
我重复了这些变量,它们都很好地发布了

谢谢大家

在PHP中不能使用+连接字符串。使用

在PHP中不能使用+连接字符串。使用


啊哈,当然,这个月使用了太多的java:S cheers,budAha当然,这个月使用了太多的java:S cheers,bud
$message .= "Email: ".$email;