I'm trying to insert data from a php page into my mySQL databse. when I refresh the page parts of my php code is being displayed on the page rather than being processed below is my code(sensitive info blocked):
<?php
$servername = "localhost";
$username = "*******";
$password = "*******";
$dbname = "accounts";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('John', 'Doe', '[email protected]')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
and this is a screenshot of the "view source", as you can see it sort of stops doing it's PHP and displaying into my page. thoughts?

.php? Accessing withhttp://?