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

Parse error: syntax error, unexpected T_VARIABLE in LINE 27

P: 2
I am gettin a error message on this script can someone help me. I can't see what is wrong. Thanks in advance for any help you can give me.
here is the error and code.

Parse error: syntax error, unexpected T_VARIABLE in /home/a4284579/public_html/contactformphp.php on line 27

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. /* Subject and Email Variables*/
  4.  
  5.     $emailSubject = 'Client Information Scripting!';
  6.     $webMaster = 'gravizdesign@live.com';
  7.  
  8. /*Gathering Data Variables*/
  9.  
  10.     $emailField = $_POST['email'];
  11.     $nameField = $_POST['name'];
  12.     $messageField = $_POST['message'];
  13.  
  14.     $body = <<<EOD
  15. <br><hr><br>
  16. Email: $email<br>
  17. Name: $name<br>
  18. Message: $message<br>
  19. EOD;
  20.  
  21.     $headers = "From: $email\r\n";
  22.     $headers .= "Content-type: text/html\r\n";
  23.     $success = mail($webMaster, $emailSubject, $body, $headers
  24.  
  25. /*    Results rendered as HTML */
  26.  
  27. $theResults = <<<EOD  
  28. <html>
  29. <head>
  30. <title>Thesiscomplete.ie - Thesis bounding made easy</title>
  31. <meta http-equiv="refresh" content"5;URL=http://thesiscomplete.ie/contactus.html">
  32. <style type="text/css">
  33. <!--
  34. body {
  35.     background-color: #444;
  36.     font-family: Verdana, Arial, Helvetica, sans-serif;
  37.     font-size: 16px;
  38.     font-style: normal;
  39.     line-height: normal;
  40.     font-weight: normal;
  41.     color: #fec001;
  42.     text-decoration: none;
  43.     padding-top: 200px;
  44.     margin-left: 200px
  45.     width: 800px
  46. }
  47. -->
  48. </style>
  49. </head>
  50.  
  51. <div>
  52. <div align="centre">Your email will be answered as soon as possible. You will be returned to Thesiscomplete in a few seconds!</div>
  53. </body>
  54. </html>
  55. EOD;
  56. echo "$theResults";
  57.  
  58. ?>
Apr 1 '10 #1
Share this Question
Share on Google+
4 Replies


code green
Expert 100+
P: 1,726
It means there is a syntax error on line 27 (or possibly earlier).
Enclose in CODE tags and tell us which is line 27
Apr 1 '10 #2

P: 2
line 27 is the following $theResults = <<<EOD
Apr 1 '10 #3

code green
Expert 100+
P: 1,726
The error is on this line
Expand|Select|Wrap|Line Numbers
  1. $success = mail($webMaster, $emailSubject, $body, $headers
  2.  
Apr 1 '10 #4

Atli
Expert 5K+
P: 5,058
There also seem to be spaces following the "<<<EOD" on the line you indicated. You need to remove them. - Nothing can follow the starting delimiter of an Heredoc string. Not until the next line, that is.
Apr 1 '10 #5

Post your reply

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