prepare("INSERT INTO case_notes (resident_id, note) VALUES (?, ?)"); $stmt->execute([$resident_id, $note]); // Redirect back to the resident's view page after successful insertion header("Location: resident_view.php?id={$resident_id}&success=note_added"); exit; } catch (PDOException $e) { // In a real app, log this error. // For simplicity, redirect with a generic error. header("Location: resident_view.php?id={$resident_id}&error=db_error"); exit; }