prepare("DELETE FROM tasks WHERE id = :id"); $query->execute(["id" => $task_id]); header("Location: /?status=deleted"); exit; } catch (PDOException $e) { //echo($e->getMessage()); header("Location: /?status=db_error"); exit; } } else{ header("Location: /?status=invalid_id"); exit; } } else { header("Location: /"); exit; }