<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
//include("../../php_crud/my_class_for_web.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
extract($_POST);

$branch_id = $_SESSION['LOGIN_BRANCH'];
$session = $_SESSION['ADMISSION_SESSION'];
/*$max_form=$obj->Max_Value("_students_admission_form","admission_form_id");
extract($max_form);


$max_val = '';
$max_form_val = '';





$table_name="_students_admission_form";
 $where_cond="_invoice_number='".$_invoice_number."' AND admission_id !=".$admission_id;
$list=$obj->num_of_rows($table_name,$where_cond);
$true = true;
if($list->num > 0){
	   $status['invoice_error'] = 'Invoice Number is Already Used'; 
	   $true = false ;	   
}

if($_class=='nine' || $_class=='eleven' ){
	if($_department==''){
		$status['department'] = 'Department Field Requred';
		}
}else $_department = '';*/

//if($true==true){
			$form_data=array(
					'_session'=>$session,
					'_invoice_number'=>$_invoice_number,
					'_std_id'=>'',
					'_candidate_name'=>$_candidate_name,
					'_class'=>$_SESSION['DETAILS_ID_FOR_EDIT_FORM'],
					//'_department'=>$_department,
					'_date_of_birth'=>$_date_of_birth?date("Y-m-d",strtotime($_date_of_birth)):NULL ,
					'_nationality'=>$_nationality,
					'_blood_group_id'=>$_blood_group_id,
					'_religion_id'=>$_religion_id,
					'_mobile_number'=>$_mobile_number,
					'_email'=>$contact_email,
					'_gender'=>$gender,
					'_std_photo'=>$file_path,
					'_present_address'=>trim($_present_address),
					'_present_district_id'=>$_present_district_id,
					'_present_thana_id'=>$_present_thana_id,
					
					'_permanent_address'=>trim($_permanent_address),
					'_permanent_district_id'=>$_permanent_district_id,
					'_permanent_thana_id'=>$_permanent_thana_id,
					'_father_name'=> $_father_name,
					'_father_occupation_id'=>$_father_occupation_id,
					'_father_mobile'=>$_father_mobile,
					'_father_mail'=>$_father_mail,
					'_father_annual_income'=>$_father_annual_income,
					'_mother_name'=>$_mother_name,
					'_mother_occupation_id'=>$_mother_occupation_id,
					'_mother_mobile'=>$_mother_mobile,
					'_mother_mail'=>$_mother_mail,
					'_update_by'=>$_SESSION['LOGIN_USERID']
					);
						
				
				
				 $entry1=$obj->Update_Data('_students_admission_form', $form_data,'admission_form_id="'.$admission_form_id.'"'); 
			/*	 if($entry1!=NULL){
					 $entry1=$obj->Delete_Data('_students_admission_academic_info','admission_id='.$admission_id); 
						
						foreach($ac AS $index=>$value){
								$form_data=array(
											'admission_id'=>$admission_id,
											'_exam_name'=>$value['exam'],
											'_roll'=>$value['roll'],
											 '_board_id'=>$value['education_board'],
											'_pass_year'=>$value['pass_year'],
											'_institute_name'=>$value['institute'],
											'_gpa'=>$value['gpa']
											
											
									);
									$entry1=$obj->Insert_Data('_students_admission_academic_info', $form_data); 
							}
					 }*/
				$status['update_status'] = 'Form Updated';
				$status['alert_message'] = $_SESSION['DETAILS_ID_FOR_EDIT_FORM'];
			// is all succefull
				
					
					
		/*$status['alert_message'] = 'admission_id='.$admission_form_id."\n".
				  '_invoice_number='.$_invoice_number."\n".
				  '_candidate_name='.$_candidate_name."\n".
				  '_date_of_birth='.$_date_of_birth."\n".
				  '_religion_id='.$_religion_id."\n".
				  '_blood_group_id='.$_blood_group_id."\n".
				  '_mobile_number='.$_mobile_number."\n".
				  'contact_email='.$contact_email."\n".
				  '_nationality='.$_nationality."\n".
				  '_present_address='.$_present_address."\n".
				  '_permanent_address='.$_permanent_address."\n".
				  '_father_name='.$_father_name."\n".
				  '_father_occupation_id='.$_father_occupation_id."\n".
				  '_father_mobile='.$_father_mobile."\n".
				  '_father_mail='.$_father_mail."\n".
				  '_mother_name='.$_mother_name."\n".
				  '_mother_occupation_id='.$_mother_occupation_id."\n".
				  '_mother_mobile='.$_mother_mobile."\n".
				  'file_path='.$file_path."\n"*/;			
					
//}else{
	//$status['status'] = 'error';
	//}
	
	echo json_encode($status);
	
?>