What am I doing wrong here? All the data was subitting until I added the last part of the code, the IF(){} statement. I want to make it where if the information was submitted correctly, for it to say THANK YOU!, else, display the error i set.
<form method="POST">
<input type="text" name="username" placeholder="username"><br />
<input type="password" name="password" placeholder="password"><br />
<input type="submit">
</form>
<?php
if(isset($_POST['username'], $_POST['password'])){
require 'core/db.php';
$conn = dbConnect()->prepare("INSERT INTO users (username, password) VALUES (?,?)");
$conn->bindParam(1, $_POST['username']);
$conn->bindParam(2, $_POST['password']);
$conn->execute();
if($conn === true){
echo 'Thanks!';
header('Location: index.php');
exit;
} else{
echo 'something went wrong';
}
}
?>