<?php session_start(); include 'php/config/autoload.inc.php'; use classes as cls; use config as cfg; $db = new cfg\database(); $ht = new cls\hospitals(); // print "<pre>" . print_r($ht->get(), 1) . "</pre>"; // exit; $hospital_option = ""; $selected = ""; foreach ($ht->get() as $k => $v) { if (isset($_GET['hospital'])) { $selected = $v['hospital_id'] == $_GET['hospital'] ? "selected" : ""; } $hospital_option .= "<option value='" . $v['hospital_id'] . "' " . $selected . ">" . $v['hospital_name'] . "</option>"; } $typeofmedical_option = ""; $selected = ""; foreach ($ht->get_typeofmedical() as $k => $v) { if (isset($_GET['typeofmedical'])) { $selected = $v['medical_type_id'] == $_GET['typeofmedical'] ? "selected" : ""; } $typeofmedical_option .= "<option value='" . $v['medical_type_id'] . "' " . $selected . ">" . $v['medical_name'] . "</option>"; } ?> <!DOCTYPE html> <html lang="en"> <head>