0

I have a form to email script that is throwing an error.

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

Here is the emailauto.php script

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

So it looks like the error is saying there is something wrong with the $email variable, but what?? It looks good to me.

user5198569
  • 49
  • 1
  • 6

1 Answers1

2

You need to use concatenation with . so this would be

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);

see php.net

jmattheis
  • 10,494
  • 11
  • 46
  • 58