Ok I have a form. You hit submit and it spits it back to you on a confirm page. You hit submit there and it is points you to the page with the following code that is supposed to email it to me.

<?

//Declare the variables
$recipient = "entries@mysite.com";
$subject = "Team Submission";
$message =
"$name
$teamname
$email
$tiebreaker
$team\";

//contents of form

$name = $_POST;
$teamname= $_POST;
$email = $_POST;
$email = $_POST;
$team = $_POST;
$headers = "Cc: $email\r\n;"

//mail() function sends the mail
mail($recipient,$subject,$message,$headers);

?>

I'm getting this error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/virtual/site30/fst/var/www/html/submitted.php on line 21

Line 21 is $name = $_POST;

Please help, I'm not THAT well versed in PHP but had this same damn form working last year and can't figure out where I'm putting or missing a ', ", or something else. :(

Ok I figured out that I had an extra \ in there, but then it's giving me this error on the mail function line:

Parse error: parse error, unexpected T_STRING in /home/virtual/site30/fst/var/www/html/submitted.php on line 31

$message = "$name$teamname$email$tiebreaker$team\";

I think should be this:

$message = "$name$teamname$email$tiebreaker$team";

or is that the first error you fixed?

Try echoing all your vars to the browser so you can see what they look like.

echo($_POST['name']);
echo($_POST['teamname']);
etc...

My guess is one of the _POST vars is not defined which would mean there is a misspelling in your submission form.

<?

//Declare the variables
$recipient = "entries@mysite.com";
$subject = "Team Submission";
$message =
"$name
$teamname
$email
$tiebreaker
$team\"; //there is no backslash on it.

//contents of form

$name = $_POST['name'];
$teamname= $_POST['teamname'];
$email = $_POST['email'];
$email = $_POST['tiebreaker'];
$team = $_POST['team'];
$headers = "Cc: $email\r\n;" //Error

//mail() function sends the mail
mail($recipient,$subject,$message,$headers);



?>

Should be like this.

<?

//Declare the variables
$recipient = "entries@mysite.com";
$subject = "Team Submission";
$message =
"$name
$teamname
$email
$tiebreaker
$team";

//contents of form

$name = $_POST['name'];
$teamname= $_POST['teamname'];
$email = $_POST['email'];
$email = $_POST['tiebreaker'];
$team = $_POST['team'];
$headers = "Cc: $email\r\n";

//mail() function sends the mail
mail($recipient,$subject,$message,$headers);



?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.