douzuita7325 2010-03-13 15:23
浏览 18
已采纳

发送邮件php

Hey, no idea why this sint working, but the message is being sent as "0". I think the e-mail fIELD is what is causing it

    <?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>";
    }
}
?>

I echoed out the variables, they all are getting posted fine

Thanks guys

  • 写回答

1条回答 默认 最新

  • dqyat62284 2010-03-13 15:26
    关注

    You can't use + to concatenate strings in PHP. Use .

    $message .= "Email: ".$email;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题