Jump to content

Parse error: syntax error, unexpected $end


Rolladome

Recommended Posts

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!!

Link to comment
https://forums.phpfreaks.com/topic/175022-parse-error-syntax-error-unexpected-end/
Share on other sites

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.