| | |
Form not working, getting parse errors...
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2005
Posts: 2
Reputation:
Solved Threads: 0
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.
<?
//Declare the variables
$recipient = "entries@mysite.com";
$subject = "Team Submission";
$message =
"$name
$teamname
$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.
[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.
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.
•
•
Join Date: Jul 2004
Posts: 234
Reputation:
Solved Threads: 8
[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]
//Declare the variables
$recipient = "entries@mysite.com";
$subject = "Team Submission";
$message =
"$name
$teamname
$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
$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]
![]() |
Similar Threads
- html/php form for .htaccess validation (PHP)
- request.form is not working in asp.net (ASP.NET)
- (C) have 2 parse errors (help) (C)
- form validation not working (JavaScript / DHTML / AJAX)
Other Threads in the PHP Forum
- Previous Thread: how can i use php to print a specified part of a web page?
- Next Thread: Help With Forum(avatars)
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions sms sockets source space spam sql syntax system table tutorial update upload url validator variable variables video web youtube





