Ok, so I have tested if the database is connected and it is. But, my problem is that the form won't go onto the output.php page to be able to save it to the database, I'm getting a NOT FOUND error. I have included a screenshot of the error, the code seems right to me but I can't figure out why it can't find the page when it's clearly in the FOLDER. Thanks for your time in advance.
form.php file
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<?php
$fname = $surname = "";
?>
<h2>Fill out user details</h2>
<form action="output.php" method="post" >
First Name: <input id="fname" type="text" name="fname" >
<br><br>
Surname <input id="surname" type="text" name="surname">
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
output.php file
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<?php $fname=$_POST["fname"];
$surname=$_POST["surname"];?>
<!--Connect to the database-->
<?php
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully"; ?>
<?php
$sql="INSERT INTO 'user'.'user_tbl'('user_fname','user_surname') VALUES ('$fname','$surname')";
mysqli($conn,$sql);
?>
<?php
header("Location: http://localhost/mysite/");
?>
</body>
</html>