I a creating a form where the user can update previously entered information in fields relative to an ID field.
However, I am getting a parse syntax error when using the HEREDOC method of displaying the modifications to the code.
My error displayed looks like this:
Parse error: syntax error, unexpected '<<' (T_SL) in /Applications/XAMPP/xamppfiles/htdocs/serverside/phptut/update.php on line 24
For reference my script on 24 onward looks like this:
echo<<<EOD
<b>The new record looks like this:</b>
Email: $email<br/>
First: $first<br/>
Last: $last<br/>
Status: $status<br/>
EOD;
And for further reference my code in totality is this
<?php
include "dbinfo.php";
//gets the variables from form submitted
$id = $_POST[id];
$email = $_POST[email];
$first = $_POST[first];
$last = $_POST[last];
$status = $_POST[status];
//sets the values where the ID is equal to what was passed in
$sql = "UPDATE contacts SET
email = '$email',
first ='$first',
last = '$last',
phone ='$phone'
where ID = '$id' ";
$result = mysql_query($sql) or die(mysql_error());
//excute
//print what the new one looks like
echo '<html><head><title>Updated Results</title></head><body>';
include ("header.php");
echo<<<EOD
<b>The new record looks like this:</b>
Email: $email<br/>
First: $first<br/>
Last: $last<br/>
Status: $status<br/>
EOD;
?>
Any help would be greatly appreciated.
echo<<<EOD
remove it and it will work, just as Phil stated below. – Fred -ii- Nov 19 at 5:14vi
identified it astrail
which I took to mean a different character. It is in fact a trailing space – Phil Nov 19 at 5:17