Hi there all, I am brand new to php (3 days under my belt). I am trying to modify a webmail.php script that came on this cd that I got with the learning php book. I am having difficulty getting the new fields I added to work. I am getting a T_String error on line 33, But I can't seem to find any errors/dont know what kind of erroroneous code bit to fix. Please help me. I have pasted my code below. I have great faith that this community will be able to assist me.
send.php code is below the line
---------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Revisit-After" content="5 Days">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Thank you for adding this customer</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" alink="#0000FF" vlink="#0000FF">
<h1>Thank you for adding this customer</h1>
<?php
$to = "matt@ag0.net"; // change to your email address
$firstname = $_POST;
$lastname = $_POST;
$email = $_POST;
$homephone = $_POST;
$workphone = $_POST;
$address = $_POST;
$city = $_POST;
$state = $_POST;
$zip = $POST;
$directions = $_POST;
$msg = $_POST;
$d = date('l dS \of F Y h:i:s A');
$sub = "CCI $firstname $lastname";
$headers = "From: $firstname $lastname <$email>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$mes .= "First Name: ".$firstname."\n;
$mes .= "Last Name: ".$lastname."\n;
$mes .= "e-mail: ".$email."\n;
$mes .= "Home Phone: ".$homephone."\n;
$mes .= "Work Phone: ".$workphone."\n;
$mes .= "Address: ".$address."\n;
$mes .= "City: ".$city."\n;
$mes .= "State: ".$state."\n;
$mes .= "Zip: ".$zip."\n;
$mes .= "Customer Directions: ".$directions."\n;
$mes .= "Additional Messages: ".$msg."\n;
$mes .= 'Date & Time Entered: '.$d;
if (empty($firstname) || empty($email) || empty($subject) || empty($msg))
{
echo " <h3>Sorry all fields are required.</h3>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
print " <h3>Sorry the email address you entered looks like it's invalid.</h3>";
}
else
{
mail($to, $sub, $mes, $headers);
print " <h3><center>Thank you ".$firstname." for contacting us.</center></h3>";
print " <h3><center>We will get back to you as soon as possible</center></h3>";
}
?>
<!-- your html -->
</body>
</html>