<?php 
include('includes/config/config.php');
include ('includes/functions.php');
include ('log_entry.php');
error_log ( "Start Printing Request Attributes" );
$requestStr="";
foreach ( $_REQUEST as $key => $value ) {
    $requestStr.=$key . " : " . $value . "\n";
    error_log ( $key . " : " . $value . "<br />\r\n" );
}
error_log ( "End Printing Request Attributes" );
save_log($requestStr,'Employee Cadre','SAVE','save_emp_cadre.php ');
$initial_query="";
$end_query="";

if(!empty($_POST['emp_cadre_id'])){
	
	$initial_query="update  emp_cadre ";
	$end_query="where emp_cadre_id='".$_POST['emp_cadre_id']."' ";
}else{
	
	$initial_query="insert into   emp_cadre  ";
	$end_query="";
}
	
$final_query=$initial_query." set emp_cadre='".$_POST['emp_cadre']."',medical_claim_limit='".$_POST['claim_limit']."',remarks='".$_POST['remarks']."',modified_by='".$_SESSION['user_id']."' ".$end_query;
// echo $final_query;

if (!$result = @mysqli_query($conn,$final_query)) {
            exit(mysqli_error($conn));
            $data="error";
            
}else{
	
	$data="success";
}

echo json_encode($data);
?>