Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email from web page - syntax error

Status
Not open for further replies.

mondeoman

MIS
Dec 7, 2006
203
GB
I am trying to develop a questionnaire on a web page that returns an email from the respondent back to me. I have a basic structure that seems ok but when I load it via ftp onto my site I get this error message:

Parse error: syntax error, unexpected $end in /home/eachfrie/public_html/EmailQues2.php on line 133

I have tried to see where I have gone wrong but can't see it - probably because the error is on top of me!.

Here is my code so far:

_________________________________________________________________

<?php
// mail ( $to , $subject , $message, $additional_headers )

$to = 'bernardkane@btinternet.com';
$subject = 'Associate Members Response to Questionnaire';


$name = $_POST['name'];
$email = $_POST['email'];
$Question1 = $_POST['Question1'];
$Question2 = $_POST['Question2'];
$Question3 = $_POST['Question3'];
$Question4 = $_POST['Question4'];
$Question5 = $_POST['Question5'];
$Question6 = $_POST['Question6'];
$Comment = $_POST['Comment'];

$message = <<<email

This is from $name
$message
from $name
email: $email

EMAIL;
$header = '$email'

if($_POST){
mail($to, $subject, $message, $header)
$feedback = 'Thank you for completing this questionnaire';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Associate Members Preference Questionnaire</title>
</head>

<body>
<p id='feedback'><?php echo $feedback; ?></p>

<form action="?" method="post">
<table width="80%" border="0" cellspacing="0" cellpadding="2">

<tr>
<td width="65%"><label for="name">Name:</label></td>
<td width="65%">
<label for="name"></label>
<input type="text" name="name" id="name"/>
</td>
</tr>
<tr>
<td width="65%"><label for="email">Email:</label></td>
<td width="65%">
<label for="email"></label>
<input type="text" name="email" id="email"/>
</td>
</tr>
<tr>
<td width="65%"><label for="Question1">Question 1: Do you think Associate Members would like an EACH welcome pack on joining?</label></td>
<td width="65%">

<label for="Question1"></label>
<select id='Question1'>
<option value="Yes" selected=selected>Yes</option>
<option value="No">No</option>
<option value="Not Sure">Not Sure</option>
</select></td>
</tr>
<tr>
<td width="65%"><label for="Question2">Question 2: Would you like to visit one of the children's hospices?</label></td>
<td width="65%">
<select id='Question2'>
<option value="Yes" selected=selected>Yes</option>
<option value="No">No</option>
<option value="Not Sure">Not Sure</option>
</select>
</td>
</tr>
<tr>
<td><label for="Question3">Question 3: Would you like to attend a Members social event each year?</label></td>
<td><select id='Question3'>
<option value="Yes" selected=selected>Yes</option>
<option value="No">No</option>
<option value="Not Sure">Not Sure</option>
</select>
</td>
</tr>
<tr>
<td><label for="Question4">Question 4: What type of event do you prefer helping with?</label></td>
<td><select id='Question4'>
<option value="Supermarkets" selected=selected>Supermarkets</option>
<option value="Events">Events</option>
<option value="Talks">Talks</option>
</select>
</td>
</tr>
<tr>
<td><label for="Question5">Question 5: Do you prefer to help during the week or at weekends?</label></td>
<td><select id='Question5'>
<option value="Weekdays" selected=selected>Weekdays</option>
<option value="Weekends">Weekends</option>
<option value="No Preference">No Preference</option>
</select>
</td>
</tr>
<tr>
<td><label for="Question6">Question 6: For supermarket collections what time suits you best?</label></td>
<td><select id='Question6'>
<option value="0900 - 1100" selected=selected>0900 - 1100</option>
<option value="1100 - 1300">1100 - 1300</option>
<option value="1300 - 1500">1300 - 1500</option>
<option value="1500 - 1700">1500 - 1700</option>
<option value="Anytime">Anytime</option>
</select>
</td>
</tr>
<tr>
<td>Please feel free to provide any feedback to our committee for ideas to improve the way we communicate with our Associate members:</td>
<td><textarea id="Comment" name="Comment" cols="42" rows="9"></textarea></td>
</tr>
<tr>
<td width="65%"><label for="Question4"></label><label for="Question3"> </label></td>

<td width="65%"></td>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</tr>
</table>
</form>
</body>
</html>

_________________________________________________________________
Can anyone see where I am going wrong please?
 
Hi ...

The problem appears to be here ....

Code:
$message = <<<email

This is from $name
$message
from $name
email: $email

EMAIL;


Comment that section out and test again it works for me in theory ...
Also I assume this should be
<<<EMAIL
bla
bla
bla
EMAIL

Like a HEAR <<EOF ~~~~ EOF document ?


Laurie.
 
You are missing several semicolons, however the more egregious mistake and the reason for the error is the mismatch in the heredoc identifiers.

Code:
$message = <<<[red]email[/red]

This is from $name
$message
from $name
email: $email

[red]EMAIL;[/red]

The identifiers must be identical so must be matching in case.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Code:
$message = <<<email

This is from $name
$message
from $name
email: $email

EMAIL;
for the heardoc syntax the identifiers need to be equivalent on a strict basis. pay attention to the case.

Code:
$header = '$email'
lines in php must be terminated.
also research the use of single quotes. variables are NOT expanded within single quotes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top