query("SELECT * FROM grievance WHERE grievance_id = '".$page."' LIMIT 1"); if ($mysqli_page->num_rows > 0){ // keep query value in array $row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ; $submit_type = 'edit' ; } // update database if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){ // update database $mysqli->query( "UPDATE grievance SET comment = '".escapeString($_POST['comment'])."', status = '".escapeString($_POST['status'])."' WHERE grievance_id = '".$page."'" ) ; if ( $row_page['status'] != $_POST['status'] ){ pushToUserCron( 'grievance', $page, $row_page['staff_id'], 'Grievance', 'Grievance has been update.' ) ; } // refresh page header("Location:app-grievance.php?page_mode=edit&page=".$page."&success=1") ; $_SESSION['system_result'] = 'success-updated' ; exit ; } if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'our-grievance-new') ) || ( $page_mode == 'edit' && !permissionCheck($row_user, 'our-grievance-edit') ) ){ header('Location: app-grievance.php') ; exit ; } // get all media $media_list = [] ; $mysqli_media = $mysqli->query( "SELECT file, filetype FROM grievance_media WHERE deleted_at IS NULL AND grievance_id = '".$page."'" ) ; if ( $mysqli_media->num_rows > 0 ){ while ( $row_media = $mysqli_media->fetch_assoc() ){ $media_list[] = $row_media ; } } // get all staff $staff_list = [] ; $mysqli_staff = $mysqli->query( "SELECT staff_id, staff_name, staff_idno FROM staff WHERE deleted_at IS NULL ".$user_branch_permission_sql) ; if ( $mysqli_staff->num_rows > 0 ){ while ( $row_staff = $mysqli_staff->fetch_assoc() ){ $staff_list[$row_staff['staff_id']] = dataFilter($row_staff['staff_name']) . ' ( ' . dataFilter($row_staff['staff_idno']) . ' )' ; } } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>