On a shopping cart, when I click the delete button, the row isn't being deleted from the database, any reason why?
<?php
if (isset($_POST['delete_button'])) {
$id = $_POST['id'];
$stmt = $pdo->prepare("DELETE FROM user_favourites WHERE user_fav_id = :user_fav_id");
$stmt->bindParam(':user_fav_id', $id);
$stmt->execute();
header("Location: index.php?p=account");
exit();
}
?>
And the button code
<form method="POST">
<input type="hidden" name="id" value="<?php echo $fav['user_fav_id'] ?>">
<button type="submit" name="delete_button">Delete</button>
</form>