50 lines
2.2 KiB
PHP
50 lines
2.2 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('log_entry.php');
|
|
$staff_id=$_POST['staff_id'];
|
|
|
|
$staff_name = $_POST['staff_name'];
|
|
$father_name = $_POST['father_name'];
|
|
$emp_code = $_POST['emp_code'];
|
|
|
|
$dob = $_POST['dob'];
|
|
$gender = $_POST['gender'];
|
|
error_log($gender);
|
|
$phone_number = $_POST['phone_number'];
|
|
$address= $_POST['address'];
|
|
$staff_category = $_POST['staff_category'];
|
|
$designation = $_POST['designation'];
|
|
$email_id = $_POST['email_id'];
|
|
$aadhar_no = $_POST['aadhar_no'];
|
|
$blood_group = $_POST['blood_group'];
|
|
$doj = $_POST['doj'];
|
|
$ohc_type=$_SESSION['current_ohcttype'];
|
|
|
|
$query="";
|
|
$imgData = null;
|
|
$photoQuery = "";
|
|
if (count($_FILES) > 0) {
|
|
$_FILES['image_logo']['tmp_name'];
|
|
if (is_uploaded_file($_FILES['image_logo']['tmp_name'])) {
|
|
$info = pathinfo($_FILES['image_logo']['name']);
|
|
$ext = pathinfo($info, PATHINFO_EXTENSION);
|
|
$imgData = addslashes(file_get_contents($_FILES['image_logo']['tmp_name']));
|
|
$imageProperties = getimageSize($_FILES['image_logo']['tmp_name']);
|
|
$photoQuery = ",image_logo='{$imgData}' ,image_type='{$imageProperties['mime']}'";
|
|
}
|
|
}
|
|
if(!empty($staff_id)){
|
|
$query = "update staff_master set staff_name='$staff_name',emp_code='$emp_code',father_name='$father_name',dob = STR_TO_DATE('".$dob."','%d/%m/%Y'),gender='$gender',phone_number='$phone_number',address ='$address',staff_category='$staff_category',designation='$designation',email_id='$email_id',aadhar_no='$aadhar_no',ohc_type='$ohc_type',blood_group='$blood_group',doj = STR_TO_DATE('".$doj."','%d/%m/%Y'),modified_by = '".$_SESSION['user_id']."' " . $photoQuery . " where staff_id =
|
|
'".$staff_id."'";
|
|
}
|
|
else {
|
|
$query = "insert into staff_master(staff_name,emp_code,father_name,dob,gender,phone_number,address,staff_category,designation,email_id,aadhar_no,blood_group,ohc_type,doj,modified_by)
|
|
values ('$staff_name','$emp_code','$father_name',STR_TO_DATE('".$dob."','%d/%m/%Y'),'$gender','$phone_number','$address','$staff_category','$designation','$email_id','$aadhar_no','$blood_group','$ohc_type',STR_TO_DATE('".$doj."','%d/%m/%Y'),'".$_SESSION['user_id']."' " . $photoQuery . " )";
|
|
}
|
|
error_log($query);
|
|
if (!$result = @mysqli_query($conn,$query)) {
|
|
error_log($query);
|
|
exit(mysqli_error($conn));
|
|
}
|
|
?>
|