60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
|
|
<?php
|
||
|
|
include('includes/config/config.php');
|
||
|
|
include('log_entry.php');
|
||
|
|
|
||
|
|
$state_id = $_POST['state_id'];
|
||
|
|
$sub_center_name = $_POST['sub_center_name'];
|
||
|
|
$sub_center_category = $_POST['sub_center_category'];
|
||
|
|
$parent_center_name = $_POST['parent_center_name'];
|
||
|
|
$shg_owner = $_POST['shg_owner'];
|
||
|
|
$mobile_no = $_POST['mobile_no'];
|
||
|
|
$village = $_POST['address'];
|
||
|
|
$state = $_POST['village'];
|
||
|
|
$district = $_POST['district'];
|
||
|
|
$tehsil = $_POST['tehsil'];
|
||
|
|
$sub_center_code = $_POST['sub_center_code'];
|
||
|
|
$ohc_type_id = $_SESSION['current_ohcttype'];
|
||
|
|
|
||
|
|
error_log($state_id . " state");
|
||
|
|
|
||
|
|
if (!empty($state_id)) {
|
||
|
|
// Update query
|
||
|
|
$query = "UPDATE others_beneficiary
|
||
|
|
SET sub_center_name = '$sub_center_name',
|
||
|
|
sub_center_code = '$sub_center_code',
|
||
|
|
sub_center_category = '$sub_center_category',
|
||
|
|
parent_center_name = '$parent_center_name',
|
||
|
|
shg_owner = '$shg_owner',
|
||
|
|
mobile_no = '$mobile_no',
|
||
|
|
village = '$village',
|
||
|
|
state = '$state',
|
||
|
|
district = '$district',
|
||
|
|
tehsil = '$tehsil',
|
||
|
|
ohc_type_id = '$ohc_type_id'
|
||
|
|
WHERE id = '$state_id'";
|
||
|
|
|
||
|
|
error_log("Update query: " . $query);
|
||
|
|
} else {
|
||
|
|
// Insert query
|
||
|
|
$query = "INSERT INTO others_beneficiary
|
||
|
|
SET sub_center_name = '$sub_center_name',
|
||
|
|
sub_center_code = '$sub_center_code',
|
||
|
|
sub_center_category = '$sub_center_category',
|
||
|
|
parent_center_name = '$parent_center_name',
|
||
|
|
shg_owner = '$shg_owner',
|
||
|
|
mobile_no = '$mobile_no',
|
||
|
|
village = '$village',
|
||
|
|
state = '$state',
|
||
|
|
district = '$district',
|
||
|
|
tehsil = '$tehsil',
|
||
|
|
ohc_type_id = '$ohc_type_id'";
|
||
|
|
|
||
|
|
error_log("Insert query: " . $query);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Execute the query
|
||
|
|
if (!$result = mysqli_query($conn, $query)) {
|
||
|
|
error_log("SQL Error: " . mysqli_error($conn));
|
||
|
|
exit(mysqli_error($conn));
|
||
|
|
}
|