Rolladome Posted September 21, 2009 Share Posted September 21, 2009 I'm having trouble with some code I wrote for a contact form on the website www.rolladome.org.uk.... when i previewed the page in dreamweaver the PHP script could be seen in the results rendered page and I assumed it was my computer so I uploaded it to the site using FTP and this error keeps appearing Parse error: syntax error, unexpected $end in /home/rollado1/public_html/contactformprocess.php on line 61 the code I used is: <?php /*Subject and Email Variables*/ $emailSubject = 'New Form Entry'; $webMaster = '[email protected]'; /*Gathering Data Variables*/ $nameField = $_POST['name']; $emailField = $_POST['email']; $phoneField = $_POST['phone']; $messageField = $_POST['message']; $mailinglistField = $_POST['mailinglist']; $body = <<<EOD <br><hr><br> Name: $name <br> Email: $email <br> Phone Number: $phone <br> Message: $message <br> Mailing List: $mailinglist<br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*Results Rendered as HTML*/ $theResults = <<<EOD <html> <head> <title>Message Sent!</title> <meta http-equiv="refresh" content="3;URL=http://www.rolladome.org.uk/index.html"> <style type="text/css"> <!-- .style1 { font-family: Geneva, Arial, Helvetica, sans-serif; font-size: large; color: #333333; } --> </style> </head> <body> <div align="center"> <p><img src="images/header.gif" width="246" height="114" alt="Logo" /></p> <p> </p> <p align="center" class="style1">Thank you for your interest, Your email will be answered very soon!</p> <p align="center" class="style1">you will be returned to the RollaDome Website in a few seconds....</p> <p> </p> </div> </body> </html> EOD; echo "$theResults"; ?> can anyone see any problems with the script..... Thanks in advance for your help!! Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/ Share on other sites More sharing options...
rhodesa Posted September 21, 2009 Share Posted September 21, 2009 there is nothing wrong with the script that i can see Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-922403 Share on other sites More sharing options...
Rolladome Posted September 21, 2009 Author Share Posted September 21, 2009 Thats what I thought... I just don't understand why this error is happening... maybe I should just start from scratch Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-922411 Share on other sites More sharing options...
knsito Posted September 21, 2009 Share Posted September 21, 2009 whats <<<EOD and EOD; ? Dont you want quotes? edit: cool didnt know about Heredoc.. neat Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-922416 Share on other sites More sharing options...
rhodesa Posted September 21, 2009 Share Posted September 21, 2009 whats <<<EOD and EOD; ? Dont you want quotes? edit: cool didnt know about Heredoc.. neat personally...i don't like that way of outputting...i think it's messy...i'd rather just close and re-open the php tags Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-922468 Share on other sites More sharing options...
kenrbnsn Posted September 21, 2009 Share Posted September 21, 2009 It looks like there could be a hidden character on this line: <?php EOD; ?> (this is the second one). Delete this line and re-type it. Ken Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-922492 Share on other sites More sharing options...
Rolladome Posted September 23, 2009 Author Share Posted September 23, 2009 No that didn't work, its still has the error on the same line. Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-923326 Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 whats <<<EOD and EOD; ? Dont you want quotes? edit: cool didnt know about Heredoc.. neat personally...i don't like that way of outputting...i think it's messy...i'd rather just close and re-open the php tags And it's pernicketty... no additional characters on the heredoc end line before the EOD; or after, no spaces between EOD and ; etc. very prone to non-obvious errors Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-923349 Share on other sites More sharing options...
Rolladome Posted September 23, 2009 Author Share Posted September 23, 2009 just incase this will help when I preview the page on my laptop the html thank you message that appears after submit button is pressed looks like this Email:$email phone:$phone Message:$message Mailing List:$mailinglist EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*Results Rendered as HTML*/ $theResults = << Thank you for your interest, Your email will be answered very soon! you will be returned to the RollaDome Website in a few seconds.... EOD; echo"$theResults"; ?> as you can see some of the php scripting is showing in the html but not all of it Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-923607 Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 Extra space after the ; in the EOD line? Quote Link to comment https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/#findComment-923608 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.