我正在000webhost上创建一个注册页面,我保存代码,打开网站,我收到此错误:解析错误:语法错误,第40行意外的T_SL。
<?php
require('config.php');
if (isset($_POST['submit']))
{
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
if($email1 == $email2 && $pass1 == $pass2)
{
//All good
$name = mysql_escape_string($_POST['name']);
$lname = mysql_escape_string($_POST['lname']);
$uname = mysql_escape_string($_POST['uname']);
$email1 = mysql_escape_string($_POST['email1']);
$email2 = mysql_escape_string($_POST['email2']);
$pass1 = mysql_escape_string($_POST['pass1']);
$pass2 = mysql_escape_string($_POST['pass2']);
$pass1 = md5($pass1);
//Check if username is taken
$check = mysql_query("SELECT * FROM users WHERE uname = '$uname'")or die(mysql_error());
if (mysql_num_rows($check)>=1) echo "Username already taken";
//Put everyting in DB
else{
mysql_query("INSERT INTO `users` (`id`, `name`, `lname`, `uname`, `email`, `pass`) VALUES (NULL, '$name', '$lname', '$uname', '$email1', '$pass1')") or die(mysql_error());
echo "Registration Successful";
}
}
else{
echo "Sorry, your email's or your passwords do not match. <br />";
}
}
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="uname" /><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="submit" value="Register" name="submit" /> </form>
EOT;
echo $form;
}
?>
我花了一些时间试图解决这个问题,但我找不到问题。
答案 0 :(得分:0)
正好在第40行$form = <<<EOT
之后,在heredoc名称之后你不能拥有任何东西,在你的情况下,你可以在&#34; EOT&#34;之后有空格。 $form = <<<EOT[space]