ohctech_p8/save_agency.php
Dushant Mali 899fb3e65a Upgrade 7 to 8
Upgrade 7 to 8
2024-11-02 18:03:13 +05:30

46 lines
1.7 KiB
PHP

<?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, 'Disposal Agency', 'SAVE', 'save_agency.php');
$agency_id = $_POST['agency_id'];
$agency_name = $_POST['agency_name'];
$agency_address = $_POST['agency_address'];
$regestration_no = $_POST['regestration_no'];
$allocated_reg_no = $_POST['allocated_reg_no'];
$HOD_Name = $_POST['HOD_Name'];
$HOD_Email = $_POST['HOD_Email'];
$current_ohcttype = $_SESSION['current_ohcttype'];
if (!empty($agency_id)) {
$query = "UPDATE disposal_agency
SET agency_name = '$agency_name',
agency_address = '$agency_address',
regestration_no = '$regestration_no',
allocated_reg_no = '$allocated_reg_no',
HOD_Name = '$HOD_Name',
HOD_Email = '$HOD_Email',
modified_by = '" . $_SESSION['user_id'] . "',
ohctype_id = '$current_ohcttype'
WHERE agency_id = '$agency_id'";
} else {
$query = "INSERT INTO disposal_agency (agency_name, agency_address, regestration_no, allocated_reg_no, HOD_Name, HOD_Email, modified_by, ohctype_id)
VALUES ('$agency_name', '$agency_address', '$regestration_no', '$allocated_reg_no', '$HOD_Name', '$HOD_Email', '" . $_SESSION['user_id'] . "', '$current_ohcttype')";
}
error_log("SQL : " . $query);
if (!$result = mysqli_query($conn, $query)) {
die(mysqli_error($conn));
}