Example #1
0
} elseif (!isset($LocationID) && !isset($_SESSION['editLocationID'])) {
    header('location: locationList.php');
}
//Lode information for location
$selectedLocation = $location->getAllLocationsById($_SESSION['editLocationID']);
$selectedLocation = mysqli_fetch_assoc($selectedLocation);
//Load Doctors list
$doctors = $location->getDoctorsList();
//get all scheduled dates for selected location
$session = new Session();
//Check for delete request
if ($Delete) {
    $session->deleteSessionBySessionId($SessionID);
}
//get All sessions for selected location
$sessions = $session->getSessionByLocationId($selectedLocation['location_id']);
//Update information on save
if (isset($btnSubmit)) {
    //create new sessions if any added first
    foreach ($txtSessionDate as $key => $date) {
        if ($date != null) {
            //query to set session date
            $result = $session->setSessionDateByLocation($btnSubmit, $txtSessionDate[$key]);
        }
    }
    //if there is session value and it is true then update location info
    if ($result && isset($result)) {
        // then query to update location by id
        $result = $location->updateLocationById($btnSubmit, $txtLocationName, $drpLocationType, $txtReferenceName, $txtEmail, $txtPhone, $txtAddress, $txtCity, $drpProvince, $txtPostelCode, $drpDoctor);
    } elseif (!isset($result)) {
        // then query to update location by id