ESH/save_training_schedule.php
2024-10-23 18:28:06 +05:30

43 lines
1.4 KiB
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
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,'Training Schedule','SAVE','save_training_schedule.php');
$schedule_id=$_REQUEST['schedule_id'];
$training_id=$_REQUEST['training_id'];
$from_date=$_REQUEST['from_date'];
$to_date=$_REQUEST['to_date'];
$trainer_name=$_REQUEST['trainer_name'];
$location=$_REQUEST['location'];
$remark=$_REQUEST['remark'];
$status=$_REQUEST['status'];
$initquery="";
$endquery="";
if(!empty($schedule_id)){
//update case
$initquery = "update ";
$endquery=" where schedule_id = '".$schedule_id."' ";
}
else {
//insert case
$initquery = "INSERT INTO ";
}
$query = $initquery." training_schedule set training_id = '".$training_id."',from_date=STR_TO_DATE('".$_POST['from_date']."', '%d/%m/%Y'), to_date =STR_TO_DATE('".$_POST['to_date']."', '%d/%m/%Y'),trainer_name = '$trainer_name' , location='$location', remarks='$remark',status='$status',modified_by='".$_SESSION['user_id']."' $endquery ";
error_log('add training'.$query) ;
$result = @mysqli_query($conn,$query);
?>