ESH/save_dept.php

33 lines
1.1 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?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,'Department','SAVE','save_dept.php');
$dept_id = $_POST['dept_id'];
$bu_id = $_POST['bu_id'];
$dept_name =$_POST['dept_name'];
$dept_headname =$_POST['dept_headname'];
$dept_email =$_POST['dept_email'];
if(!empty($dept_id)){
$query = "update department set dept_name = '$dept_name',dept_id = '$dept_id',bu_id = '$bu_id',dept_headname = '$dept_headname',dept_email = '$dept_email',modified_by = '".$_SESSION['user_id']."' where dept_id='".$dept_id."'";
}
else {
$query = "insert into department(dept_name, dept_id,bu_id,dept_headname,dept_email, modified_by)
values ('$dept_name','$dept_id','$bu_id','$dept_headname','$dept_email','".$_SESSION['user_id']."' ); ";
}
error_log($query);
if (!$result = @mysqli_query($conn,$query)) {
exit(mysqli_error($conn));
}
?>