473,395 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to fix Parse error: syntax error, unexpected T_VARIABLE

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
3 5158
Markus
6,050 Expert 4TB
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
6,050 Expert 4TB
Is the code you posted in the file contactengine.php? Is this file include()'d by another file?
May 29 '10 #3
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

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

Similar topics

14
by: sam | last post by:
When I run this SQL query: SELECT u.*, o.* FROM users u, orders o WHERE TO_DAYS(o.order_date) BETWEEN TO_DAYS('2003-09-20')-10 AND TO_DAYS('2003-09-20')+10
1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Donald Canton | last post by:
Hi, I'm using Bjarne's book to learn C++ and am stuck on the Calc program in Section 6. Everything works fine except when I try to use istringstream to parse a token from the command line. I...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
2
by: david | last post by:
Anyone could give me a hand about this syntax error? Thank you. David Source Code: Dim conn As New SqlConnection(strConn) Dim daAngio As New SqlDataAdapter(strSelectStatement, conn) 'Create a...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
4
by: nickyeng | last post by:
i calling this piece of java code in jsp : List<Customer> list = Customer.listby_page(currentRs); ... ... then it gives me the following error:
0
by: Alexis Boutillier | last post by:
Timothy Grant a écrit : As you can see in my last response, this problem is not linked to the type of error, If I "raise" a SystemError instead of creating a SyntaxError I still can't access...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.