<?php
require('config.php');
if(isset($_post['submit'])){
//Perform Verification
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
if($email1 == email2) {
$firstName = mysql_escape_string($_POST['firstName']);
$lastName = mysql_escape_string($_POST['lastName']);
$username = mysql_escape_string($_POST['username']);
$email1 = mysql_escape_string($email1);
$email2 = mysql_escape_string($email2);
$phone = mysql_escape_string($_POST['phone']);
$sql = mysql_query("SELECT * FROM `websiteAccount` WHERE `username` = '$username'");
if(mysql_num_rows($sql) > 0) {
echo "Sorry, that usename is already in use.";
exit();
}
mysql_query("INSERT INTO `websiteAccount` (`id`, `firstName`, `lastName`, `username` `email`, `phone`) VALUES (NULL, '$firstName', '$lastName', '$username', '$email1', '$phone')");
}else{
echo "Emails do not match";
}
}else{
$form = <<<EOT
<form action="register.php" method="post">
First Name:<br><input type="text" name="firstName"><br>
Last Name:<br><input type="text" name="lastName"><br>
Username:<br><input type="text" name="username"><br>
Email:<br><input type="text" name="email1"><br>
Confirm Email:<br><input type="text" name="email2"><br>
Phone:<br><input type="text" name="phone"><br>
<inpu type="submit" value="Register" name="submit">
</form>
EOT;
echo $form;
}
?>
When I tried to open this code in my PHP Server: I received a message saying Parse error: syntax error, unexpected end of file in /Applications/XAMPP/xamppfiles/htdocs/Web/register.php on line 48
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Warning
It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;).
EOT;
^
You need to remove this extra space.