By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,423 Members | 2,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,423 IT Pros & Developers. It's quick & easy.

How to fix Parse error: syntax error, unexpected T_VARIABLE

P: 2
Looking for help with this Contact Form.

The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks more complicated now.

Anyway, here's the error:
"Parse error: syntax error, unexpected T_VARIABLE in /home/xxx/public_html/yyy/zzz/contactengine.php on line 1"
It's a contact form from css-tricks, when I submit that's what I get.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $EmailFrom = "xxxxxxxxx@gmail.zzz";
  4. $EmailTo = "yyyyyyyyy@gmail.zzz";
  5. $Subject = "Messaggio";
  6. $Name = Trim(stripslashes($_POST['Name'])); 
  7. $Tel = Trim(stripslashes($_POST['Tel'])); 
  8. $Email = Trim(stripslashes($_POST['Email'])); 
  9. $Message = Trim(stripslashes($_POST['Message'])); 
  10.  
  11. // validation
  12. $validationOK=true;
  13. if (!$validationOK) {
  14.   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  15.   exit;
  16. }
  17.  
  18. // prepare email body text
  19. $Body = "";
  20. $Body .= "Name: ";
  21. $Body .= $Name;
  22. $Body .= "\n";
  23. $Body .= "Tel: ";
  24. $Body .= $Tel;
  25. $Body .= "\n";
  26. $Body .= "Email: ";
  27. $Body .= $Email;
  28. $Body .= "\n";
  29. $Body .= "Message: ";
  30. $Body .= $Message;
  31. $Body .= "\n";
  32.  
  33. // send email 
  34. $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
  35.  
  36. // redirect to success page 
  37. if ($success){
  38.   print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
  39. }
  40. else{
  41.   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  42. }
  43. ?>
May 29 '10 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
There's no error there. Unless, of course, there is no POST array defined (and you'll get undefined index notices). What exactly is the error?
May 29 '10 #2

Markus
Expert 5K+
P: 6,050
Is the code you posted in the file contactengine.php? Is this file include()'d by another file?
May 29 '10 #3

P: 2
First question, answer yes, second answer no...

<form method="post" action="contactengine.php">

It's a contact form that I found at css-tricks
May 30 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.