Form not working, getting parse errors...

Reply

Join Date: Mar 2005
Posts: 2
Reputation: johnnybt is an unknown quantity at this point 
Solved Threads: 0
johnnybt johnnybt is offline Offline
Newbie Poster

Form not working, getting parse errors...

 
0
  #1
Mar 27th, 2005
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['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);



?>

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['name'];

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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 2
Reputation: johnnybt is an unknown quantity at this point 
Solved Threads: 0
johnnybt johnnybt is offline Offline
Newbie Poster

Re: Form not working, getting parse errors...

 
0
  #2
Mar 28th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Form not working, getting parse errors...

 
0
  #3
Mar 28th, 2005
[PHP]$message = "$name$teamname$email$tiebreaker$team\";[/PHP]

I think should be this:

[PHP]$message = "$name$teamname$email$tiebreaker$team";[/PHP]
or is that the first error you fixed?

Try echoing all your vars to the browser so you can see what they look like.
[PHP]
echo($_POST['name']);
echo($_POST['teamname']);
etc...
[/PHP]
My guess is one of the _POST vars is not defined which would mean there is a misspelling in your submission form.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Form not working, getting parse errors...

 
0
  #4
Mar 30th, 2005
[PHP]<?

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



?>[/PHP]

Should be like this.

[PHP]<?

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



?>[/PHP]
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC