When I click the submit button on index.php page, absolutely nothing happens which surprises me since I'm following a tutorial and the code is exactly the same. I checked it over several times but to no avail. One thing I noticed is that when I enter http://localhost:8888/phplessons/signup.php page, it actually creates a row in my database, however the row only has id which is the primary key and the auto-incremented field whilst first, last, username and password fields are empty. I can only assume something is wrong with my button?
index.php code:
<?php
include 'db.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Playground</title>
<meta name="viewport" content="width=device-width, initial-scale=1 shrink-to-fit=no">
</head>
<body>
<form action="signup.php" method="POST">
<input type="text" name="first" placeholder="First Name"></form>
<input type="text" name="last" placeholder="Last Name"></form>
<input type="text" name="username" placeholder="Username"></form>
<input type="password" name="password" placeholder="Password"></form>
<button type="submit">Sign Up</button>
</form>
</body>
</html>
signup.php code:
<?php
include 'db.php';
$first = $_POST['first'];
$last = $_POST['last'];
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "INSERT INTO user (id, first, last, username, password)
VALUES (NULL, '$first','$last','$username','$password')";
$result = mysqli_query($conn, $sql);
?>