$value){ $array_family_member[] = array('name' => $_POST['family_member_name'][$value], 'dob' => $_POST['family_member_dob'][$value], 'occupation' => $_POST['family_member_occupation'][$value], 'education' => $_POST['family_member_education'][$value]) ; } } // family children $family_child_key = $_POST['family_child_key'] ; $array_family_child = array() ; if (arrayCheck($family_child_key)){ foreach($family_child_key as $key => $value){ $array_family_child[] = array('name' => $_POST['family_child_name'][$value], 'dob' => $_POST['family_child_dob'][$value], 'occupation' => $_POST['family_child_occupation'][$value], 'education' => $_POST['family_child_education'][$value]) ; } } // educational level $education_key = $_POST['education_key'] ; $array_education = array() ; if (arrayCheck($education_key)){ foreach($education_key as $key => $value){ $array_education[] = array('year' => $_POST['education_year'][$value], 'school' => $_POST['education_name_school'][$value], 'qualification' => $_POST['education_qualification'][$value]) ; } } $education_others = escapeString($_POST['education_others']) ; // employment history $employment_key = $_POST['employment_key'] ; $array_employment = array() ; if (arrayCheck($employment_key)){ foreach($employment_key as $key => $value){ $array_employment[] = array('date' => $_POST['employment_date'][$value], 'employer' => $_POST['employment_employer'][$value], 'positionheld' => $_POST['employment_positionheld'][$value], 'contacts' => $_POST['employment_contacts'][$value], 'salary' => $_POST['employment_salary'][$value], 'reasons' => $_POST['employment_reasons_leaving'][$value]) ; } } // personality $personality_language_spoken = escapeString($_POST['personality_language_spoken']) ; $personality_language_written = escapeString($_POST['personality_language_written']) ; $personality_own_strengths = escapeString($_POST['personality_own_strengths']) ; $personality_own_weakness = escapeString($_POST['personality_own_weakness']) ; $personality_aims = escapeString($_POST['personality_aims']) ; $personality_overtime = escapeString($_POST['personality_overtime']) ; $personality_pressure = escapeString($_POST['personality_pressure']) ; $personality_available_work = escapeString($_POST['personality_available_work']) ; $personality_contract = escapeString($_POST['personality_contract']) ; $personality_notice = escapeString($_POST['personality_notice']) ; // salary $salary_last_drawn = escapeString($_POST['salary_last_drawn']) ; $salary_expected_salary = escapeString($_POST['salary_expected_salary']) ; // references $references_key = $_POST['references_key'] ; $array_references = array() ; if (arrayCheck($references_key)){ foreach($references_key as $key => $value){ $array_references[] = array('name' => $_POST['references_name'][$value], 'position' => $_POST['references_position'][$value], 'contacts' => $_POST['references_contracts'][$value], 'years' => $_POST['references_years'][$value]) ; } } // aknowledgement and authorization $acknowledgement_certify = escapeString($_POST['acknowledgement_certify']) ; $acknowledgement_authorize = escapeString($_POST['acknowledgement_authorize']) ; $acknowledgement_event = escapeString($_POST['acknowledgement_event']) ; // signature $application_signature = escapeString($_POST['application_signature']) ; $application_signature_date = TODAYDATE ; // interview by $incharge_person = escapeString($_POST['incharge_person']) ; $information_interview_date = escapeString($_POST['information_interview_date']) ; $information_interview_comments = escapeString($_POST['information_interview_comments']) ; // status $employment_status = escapeString($_POST['employment_status']) ; // keep other value in array $array_other_details = array('family' => array('background' => array('father_name' => $family_father_name, 'father_occupation' => $family_father_occupation, 'mother_name' => $family_mother_name, 'mother_occupation' => $family_mother_occupation, 'spouse_name' => $family_spouse_name, 'spouse_occupation' => $family_spouse_occupation), 'member' => $array_family_member, 'child' => $array_family_child), 'education' => array('school' => $array_education, 'others' => $education_others), 'employment' => $array_employment, 'personality' => array('language_spoken' => $personality_language_spoken, 'language_written' => $personality_language_written, 'own_strengths' => $personality_own_strengths, 'own_weakness' => $personality_own_weakness, 'aims' => $personality_aims, 'overtime' => $personality_overtime, 'pressure' => $personality_pressure, 'available_work' => $personality_available_work, 'contract' => $personality_contract, 'notice' => $personality_notice), 'salary' => array('last_drawn' => $salary_last_drawn, 'expected_salary' => $salary_expected_salary), 'references' => $array_references, 'acknowledgement' => array('certify' => $acknowledgement_certify, 'authorize' => $acknowledgement_authorize, 'event' => $acknowledgement_event), 'application' => array('signature' => $application_signature, 'date' => $application_signature_date), 'interview' => array('date' => $information_interview_date, 'comments' => $information_interview_comments) ) ; $array_other_details = jsonEncodeDecode('encode', $array_other_details) ; $status = $_POST['status']; $status1 = $_POST['status1']; $id = $_POST['id']; $descrition = $_SESSION['system_name'].'(username) ' ; $record = ''; $page_id = ''; switch ($status) { case 'new': switch ($status1) { case 'not-yet': $descrition .= 'click on application form but not submit yet'; break; case 'insert': $descrition .= 'submit an new application form'; break; default: $descrition .= 'click on new application form'; break; } $page_id = '200'; break; case 'edit': switch ($status1) { case 'not-yet': $descrition .= 'edit application form but not submit yet'; break; case 'insert': $descrition .= 'submit an edited application form'; break; default: $descrition .= 'click on edit application form'; break; } $page_id = '200'; break; case 'unknown': switch ($status1) { case 'not-yet': $descrition .= 'click on unknown application form but not submit yet'; break; case 'insert': $descrition .= 'submit an unknown application form'; break; default: $descrition .= 'click on unknown application form'; break; } $page_id = '201'; break; } if ($mysqli->query("INSERT INTO system_log (log_table, log_action, log_page_id, log_user_id, log_description, log_record, log_date) VALUES ('employment', '".$status."', ".$page_id.", '".$_SESSION["system_id"]."', '".$descrition."', '".$array_other_details."', NOW())")){ return "success"; }else{ return "fail"; } ?>