ESH/save_form32.php
2024-10-23 18:28:06 +05:30

33 lines
1.3 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
$query_initial = "";
$endquery = "";
begin();
$id = getFieldFromTable('id', 'form_32', 'checkup_id', $_REQUEST['checkup_id32']);
if (!empty($id) && $id != null) {
$query_initial = "update ";
$endquery = " where id = '" . $id . "' ";
} else {
$query_initial = "insert into ";
}
error_log("checkup id in save form 32 file " . $_REQUEST['checkup_id32']);
$query_checkup = "update checkup_form set form_type='" . $_POST['form_type'] . "' where checkup_id='" . $_REQUEST['checkup_id32'] . "' ";
mysqli_query($conn, $query_checkup);
$query = $query_initial . " form_32 set checkup_id='" . $_POST['checkup_id32'] . "', date_leaving=STR_TO_DATE('" . $_POST['date_leaving'] . "', '%Y-%m-%d'),reason_for_discharge='" . $_POST['reason_for_discharge'] . "',signs_symptoms='" . $_POST['signs_symptoms'] . "', nature_tests='" . $_POST['nature_tests'] . "',period_temp_withdrawal='" . $_POST['period_temp_withdrawal'] . "',reason_withdrawal='" . $_POST['reason_withdrawal'] . "',date_unfit=STR_TO_DATE('" . $_POST['date_unfit'] . "', '%Y-%m-%d'),date_fitness=STR_TO_DATE('" . $_POST['date_fitness'] . "', '%Y-%m-%d') " . $endquery;
error_log("ehwifhew" . $query);
if (!$result = mysqli_query($conn, $query)) {
rollback();
exit(mysqli_error($conn));
}
commit();