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 = 'rolladome@btinternet.com';

 

/*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
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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.