Add safer checks for \ variable

Add isset() and is_array() checks before using \ to prevent
PHP warnings/errors if variable is not set or not an array.

This ensures cleaner JavaScript output even if the variable is undefined.
This commit is contained in:
DevSoftTech Server 2026-06-06 06:05:32 +05:30
parent d3e50174b5
commit 1a592eda7c

View File

@ -1668,7 +1668,7 @@ $allergyStatusNoKnown = in_array($allergyStatusNormalized, ['no known drug aller
function initDischargeComplaintsTable() {
// Load existing complaints from PHP (if any)
<?php if (!empty($complaint_rows)): ?>
<?php if (isset($complaint_rows) && is_array($complaint_rows) && !empty($complaint_rows)): ?>
selectedDischargeComplaints = [
<?php
$itemCount = count($complaint_rows);