I am trying to create a sign up website (for practice) using sql and php. The server I am using is xampp who i have tested using http://localhost/info.php
and it returns the php info as requsted. I have saved all my files in the htdocs folder within the xampp folder. But when i run my code, everytime the form is submitted, it shows the php source code. I am fairly new to this, please help
login.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form action="signup.php" method="POST">
<input type="text" name="first" placeholder="Firstname"><br />
<input type="text" name="last" placeholder="Lastname"><br />
<input type="text" name="uid" placeholder="Username"><br />
<input type="password" name="pwd" placeholder="Password"><br />
<button type="submit">SIGN UP</button>
</form>
</body>
</html>
<?php
include 'dbh.php';
$first = $_POST['first'];
$last = $_POST['last'];
$uid = $_POST['uid'];
$pid = $_POST['pwd'];
echo $first;
echo $last;
echo $uid;
echo $pid;
?>
dbh.php:
<?php
$conn = mysqli_connect("localhost", "root", "password", "login");
if(!$conn){
die("Connection failed: ".mysqli_connect_error());
}
?>