I am on a localserver learning mysql and php on my local server MAMP, below i will put the code to all three of my files index.php, signup.php and dbh.php. I am trying to create a log in system but it does not send the information in the database but i do not get an error message either when running it runs fine but does not add the information that i entered in the sign up form.
My database name is drugcity and my username is drugcity_data and my password is admin
So please help been trying for hours!
index.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Drug City</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<form action="signup.php" method="POST">
<input type="text" name="usrname" placeholder="Username Here"><br>
<input type="password" name="pwd" placeholder="Password Here"><br>
<button>Sign Up</button>
</form>
</body>
</html>
signup.php
<?php
include 'dbh.php';
$username = $_POST['usrname'];
$pass = $_POST['pwd'];
$sql = "INSERT INTO users(usrname, pwd) VALUES ('$username','$pass')";
$result = mysqli_query($conn, $sql);
header("Location: index.php");
?>
dbh.php
<?php
$user = 'drugcity_data';
$password = 'admin';
$db = 'drugcity';
$host = 'localhost';
$port = 8889;
$conn = mysqli_connect($link, $host, $user, $password, $db, $port);
?>