I am writing a code that contains HTML as well as PHP commands. When I try to run the code on my browser, I get this message :
Parse error: syntax error, unexpected $end in C:\WAMP\www\urr00001\SummerProject\projectquestionnaire.php on line 21.
I don't understand why line 21 is wrong. I was under the assumption that the "echo <<<_END ... _END" construct must be used whenever multiline HTML must be output. But the browser does not like this. My code is shown below. How can I correct this situation, please?
<?php //questionnaire.php
if (isset($_POST['name'])) $name = $_POST['name'];
else $name = "(Not entered)";
echo <<<_END
<html>
<head>
<title>Questionnaire</title>
</head>
<body>
Your name is: $name<br>
<form method="post" action="questionnaire.php">
What is your name?
<input type="text" name="name">
<input type="submit">
</form>
</body>
</html>
_END;
?>
_END;remove them, which is most likely the problem.