From 268b2c68fbd1c5d1d82b44aea3fe20d0217c595e Mon Sep 17 00:00:00 2001 From: Gayangi Seneviratne <57158013+sgayangi@users.noreply.github.com> Date: Thu, 27 Aug 2020 12:04:35 +0530 Subject: [PATCH] Updated ExistingPatient.php Session variables updated --- .../PatientForms/ExistingPatient.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/app/controllers/PatientForms/ExistingPatient.php b/app/controllers/PatientForms/ExistingPatient.php index edaac16..ffb2b85 100644 --- a/app/controllers/PatientForms/ExistingPatient.php +++ b/app/controllers/PatientForms/ExistingPatient.php @@ -1,6 +1,8 @@ - - + + + @@ -52,7 +54,14 @@ } $columns = array('RegNo', 'FullName', 'Age', 'Gender', 'FullAddress', 'DateOfBirth', 'Diagnosis', 'BedNo','ContactNo'); - $results = $medical->retrieveData("patients", $columns, $_SESSION["regNo"]); + if(isset($_POST['regNo'])){ + $regNo = $_POST["regNo"]; + $_SESSION["regNo"] = $_POST['regNo']; + } + else if(isset($_SESSION['regNo'])){ + $regNo = $_SESSION["regNo"]; + } + $results = $medical->retrieveData("patients", $columns, $regNo); if (mysqli_num_rows($results)!=0) { while($row = mysqli_fetch_array($results)){ $regNo = $row['RegNo']; @@ -70,13 +79,13 @@ else{ $admission = "Admitted"; } - $patient = new Patient($regNo, $name, $age, $address,$diagnosis,$dob,$gender,$admission, $bedNo, $contact,"Existing"); $_SESSION["Patient"] = $patient; $patient->displayUI(); //include '../../views/ExistingPatient/ExistingPatientForm.php'; } } + else{ echo "Registration number not found."; } @@ -84,3 +93,4 @@ +