0

i have been making a login form with PHP. And i keep on getting the error

Parse error: syntax error, unexpected end of file in [File Dir] on line 28 I have tried looking at other forms but they haven't worked

Code:

<?php

require('config.php');

if(isset($_POST['submit'])){

}else{

  $form = <<<EOT
  <form action="register.php" method="POST">
  First Name: <input type="text" name="name" /><br />
  Last Name: <input type="text" name="lname" /><br />
  UserName: <input type="text" name="username" /><br />
  Email: <input type="text" name="email1" /><br />
  Confirm Email: <input type="text" name="email2" /><br />
  Password: <input type="password" name="pass1" /><br />
  Confirm Password: <input type="password" name="pass2" /><br />
  <input type="sumbit" value="Register" name="submit" />
  </form>
  EOT;
  echo $form;

}

?>
chris85
  • 23,846
  • 7
  • 34
  • 51
Mateo
  • 71
  • 1
  • 3
  • 11

1 Answers1

3

There should be no other character before & after EOT;. PHP heredoc manual says:

It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon.

$form = <<<EOT
  <form action="register.php" method="POST">
  ...
  </form>
EOT;
// No other character is allowed around EOT;
Kita
  • 2,604
  • 19
  • 25
  • What do u mean "No Space Allowed – Mateo Aug 28 '15 at 19:40
  • @GhostCyborg No other character is allowed before & after the closing identifier `EOT;` -including spaces/tabs. In other words, the heredoc closing line needs to be exact `EOT;` without any indentations nor trailing characters. – Kita Aug 28 '15 at 20:13