prepare($sql); $stmt->execute([$resident_id, $partner_id, $staff_id, $notes]); header("Location: resident_view.php?id={$resident_id}&success=referral_sent"); exit; } catch (PDOException $e) { // Log error in a real app header("Location: create_referral.php?resident_id={$resident_id}&error=db_error"); exit; }