I'm trying to populate an html textbox value with the $Firstname, but I keep getting a HTTP 500 Internal Server Error. The insert php part works perfectly fine.
this is my PHP code. The box I'm trying to set is down the bottom.
<?php
$Firstname = $_POST['Fname'];
$Surname = $_POST['Lname'];
$UserName = $_POST['UName'];
$Password = $_POST['Password'];
$Valid = mysql_connect('localhost' , 'root' , 'pword');
if(!$Valid)
{
echo 'Could not connect' . mysql_error();
}
else
{
mysql_select_db('accounts', $Valid) or die('could not select database');
$query = "INSERT INTO `users` (`UserName`, `Password`, `FirstName`, `Surname`) VALUES ('".$UserName."' , '".$Password."' , '".$Firstname."' , '".$Surname."')";
mysql_query($query, $Valid) or die('Error Adding the users details.');
echo "The following user " . $Firstname . " has been added to the database";
}
<html>
<body>
<input type="text" name="UName" size="30" value=<?php echo htmlentities($Firstname); ?>/><br/>
</body>
</html>
?>