csrtechnew.ohctech.in/save_enrol.php
2025-04-14 13:28:09 +05:30

44 lines
1.5 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, 'Schedule', 'SAVE', 'save_enrol.php');
$id = $_POST['id']; // Get the id from the form data
$batch_id = $_POST['batch_id'];
$beneficiary_id = $_POST['beneficiary_id'];
$status = $_POST['status'];
$status_comments = $_POST['status_comments'];
$enrol_approval_status = $_POST['enrol_approval_status'];
if (!empty($id)) { // Check for the presence of id to determine update or insert
$query = "UPDATE training_batch_enrollment
SET batch_id = '$batch_id',
beneficiary_id = '$beneficiary_id',
status = '$status',
status_comments = '$status_comments',
enrol_approval_status = '$enrol_approval_status',
updated_at = NOW()
WHERE id = '$id'";
} else {
$query = "INSERT INTO training_batch_enrollment
(batch_id, beneficiary_id, status, status_comments, enrol_approval_status, created_at, updated_at)
VALUES
('$batch_id', '$beneficiary_id', '$status', '$status_comments', '$enrol_approval_status', NOW(), NOW())";
}
error_log($query);
if (!$result = @mysqli_query($conn, $query)) {
exit(mysqli_error($conn));
}
?>