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