connect_error) { die("Connection failed: " . $mysqli->connect_error); } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id'])) { $note_id = $_POST['id']; $stmt = $mysqli->prepare("DELETE FROM notes WHERE id = ?"); $stmt->bind_param("i", $note_id); $stmt->execute(); $stmt->close(); echo "Nota excluída com sucesso!"; } else { echo "Dados inválidos."; } $mysqli->close(); ?>