PHP表单到电子邮件脚本不起作用?

时间:2015-08-09 15:28:44

标签: php

我有一个发送错误的电子邮件脚本表单。

PHP Parse error:  syntax error, unexpected '$email' (T_VARIABLE) in /home/elephants/js/emailauto.php on line 30

这是emailauto.php脚本

<?php


$admin_email = "email@gmail.com";
$name = $_POST['name'];
$email = $_POST['email'];
$address = $_POST['address'];
$carrier = $_POST['carrier'];
$yes = $_POST['yes'];
$no = $_POST['no'];

$renewal = $_POST['renewal'];
$homephone = $_POST['homephone'];
$cellphone = $_POST['cellphone'];
$year = $_POST['year'];
$makemodel = $_POST['makemodel'];
$twowd = $_POST['twowd'];
$fourwd = $_POST['fourwd'];
$vin = $_POST['vin'];
$damage = $_POST['damage'];
$payment = $_POST['payment'];
$umuim = $_POST['umuim'];
$drivername = $_POST['drivername'];
$driverbday = $_POST['driverbday'];
$ssn = $_POST['ssn'];
$dlnumber = $_POST['dlnumber'];
$dlstate = $_POST['dlstate'];
$violations = $_POST['violations'];

mail($admin_email, "Auto Quote Request", "From:" $email, $address, $carrier, $yes, $no, $carrier, $renewal, $homephone, $cellphone, $year, $makemodel, $twowd, $fourwd, $vin, $damage, $payment, $umuim, $drivername, $driverbday, $ssn, $dlnumber, $dlstate, $violations);

//Email response
echo "Thank you for contacting us!";
}
 ?>

所以看起来错误是说$ email变量有问题,但是什么?这对我来说很好。

1 个答案:

答案 0 :(得分:2)

您需要使用.的连接,这样就是

mail($admin_email, "Auto Quote Request", "From:" . $email, $address, $carrier, $yes, $no, $carrier, $renewal, $homephone, $cellphone, $year, $makemodel, $twowd, $fourwd, $vin, $damage, $payment, $umuim, $drivername, $driverbday, $ssn, $dlnumber, $dlstate, $violations);

请参阅php.net