query("SELECT * FROM staff_health WHERE health_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 ){ $boolean_new = false ; if ( $page == '' ){ $mysqli->query("INSERT INTO staff_health ( created_at ) VALUES ( '".TODAYDATE."' )") ; $page = $mysqli->insert_id ; $boolean_new = true ; } // update database $mysqli->query("UPDATE staff_health SET staff_id = '".escapeString($_POST['staff_id'])."', temperature = '".escapeString($_POST['temperature'])."', health_reason = '".escapeString($_POST['health_reason'])."' WHERE health_id = '".$page."'") ; // refresh page if ( $boolean_new ){ header("Location:hr-health.php?page_mode=new&page=&success=1") ; }else{ header("Location:hr-health.php?page_mode=edit&page=".$page."&success=1") ; } $_SESSION['system_result'] = 'success-updated' ; exit ; } if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'attendance-health-new') ) || ( $page_mode == 'edit' && !permissionCheck($row_user, 'attendance-health-update') ) ){ header('Location: hr-health.php') ; exit ; } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; // get all requires // 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']) . ' )' ; } } ?>