-4

Well I'm endeavoring to combine an html signup form and its php response script into a single program in one file. please check code below: Problem is, every time I try to run this program the Parse error syntax error, unexpected '<<' (T_SL) shows up! What could be the possible problem? help will be greatly appreciated..

<!DOCTYPE html> 
<head><title>home</title></head> 
<body> 
<?php if (filter_has_var(INPUT_POST, "username")){ 
// the form exists, so work with it 
$username=filter_input(INPUT_POST, "username"); 
print "<center><h1>Great going $username!<br>What type of room would you like to create?</h1></center>"; 
} else {
 //there's no input, hence create the form 
print <<<HERE 
<form action="php/index.php" method="post"> <center>     
<input type="text" name="fullname" placeholder="Full Name" size="25" required> 
<input type="email" name="email" placeholder="Email or Mobile" size="25" required> 
<input type="password" name="psw" placeholder="Password" size="25" required> </center><br> 
<input type="submit" value="Here You Go!"/><br><br> 
<center><h4>By clicking "Here You Go!" you agree with our terms & conditions and private policy.</h4></center> </form> HERE; 
} //end 'value exists' if ?> 
</body> 
</html>

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj

Amar Pratap
  • 1,000
  • 7
  • 20
Kenny Kamei
  • 69
  • 1
  • 1
  • 11
  • Also this additional reference material for you read http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc – Charlotte Dunois Aug 22 '16 at 09:17
  • The `code` u provided in ur post contains only 20 odd lines, whereas the error is on line 167 as per ur question. R u sure u posted exact code sample that produced the error? – Amar Pratap Aug 22 '16 at 09:40
  • there's more but it's huge..so i dint provide the entire code...anyways line 167 refers to the code line: print << – Kenny Kamei Aug 22 '16 at 09:43

1 Answers1

1

An issue with your code is that you had a space character after HERE in print <<<HERE
Please remove it.

Also you have to move closing HERE; to the new line and delete the space after ;

As demonstrated in https://3v4l.org/djrjq

Naktibalda
  • 13,705
  • 5
  • 35
  • 51