I need to make a delete button that only the admin can see. The button needs to delete an item in my database but I'm having troubles with the last part.
I used this code to create the button and to call the delete function when it's clicked
if ($_SESSION['UserID'] == 1) {
echo '<button name="featureDelete"> Delete </button>' . '<br>';
if (isset($_POST['featureDelete'])) {
$deleteFeature = $feature->Delete($row);
}
}
And this is my delete function in my class
public function Delete($row)
{
$db = new db();
$sql= "DELETE FROM features WHERE FeatureID ='".$row['FeatureID']."'";
$db->conn->query($sql);
}
So I can see the button, but when I click it nothing happens, I even tried echo'ing something, but didn't get a result. What am I missing?