This question already has an answer here:
I'm facing an error
"Parse error: syntax error, unexpected end of file in C:\wamp64\www\PHP\New\input.php on line 25"
Heres My Code, any help ll'be highly appreciated.
<HTML>
<?php
if($submit)
{
$db = mysql_connect("localhost", "root","");
mysql_select_db("learndb",$db);
$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary)
VALUES ('$first','$last','$nickname','$email','$salary')";
$result = mysql_query($sql);
echo "Thank you! Information entered.
";
}
else
{
?>
<form method="post" action="input.php">
First name:<input type="Text" name="first">
Last name:<input type="Text" name="last">
Nick Name:<input type="Text" name="nickname">
E-mail:<input type="Text" name="email">
Salary:<input type="Text" name="salary">
<input type="Submit" name="submit" value="Enter information"></form>
< ?
}
?>
</HTML>
</div>
Change < ?
to <?php
. Short open php tags are a bad practice and are not always enabled by default. To enable short tags, go to your php.ini file and set short_open_tag=On
. After that restart your Apache server.
Also for a short tag to work in your code you need to remove the space between < and ?.