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

34 lines
1.4 KiB
PHP

<?php
include('includes/config/config.php');
include ('includes/functions.php');
include_once 'log_entry.php';
$checklist_id=$_POST['checklist_id'];
$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,'Firstaid register','SAVE','save_firstaid_register.php');
$ambulance_no = $_POST['ambulance_no'];
$firstaid_box = $_POST['firstaid_box'];
$oxygen_cylinder = $_POST['oxygen_cylinder'];
$bedsheet = $_POST['bedsheet'];
$pillow_cover = $_POST['pillow_cover'];
$siren = $_POST['siren'];
$query="";
if(!empty($checklist_id)){
$query = "update ambulance_checklist set ambulance_id='$ambulance_no',firstaid_box='$firstaid_box',oxygen_cylinder='$oxygen_cylinder',bedsheet='$bedsheet',pillow_cover='$pillow_cover',siren='$siren' where checklist_id ='".$checklist_id."'";
}
else {
$query = "insert into ambulance_checklist(ambulance_id,firstaid_box,oxygen_cylinder,bedsheet,pillow_cover,siren,modified_by)
values ('$ambulance_no','$firstaid_box','$oxygen_cylinder','$bedsheet','$pillow_cover','$siren','".$_SESSION['user_id']."' )";
}
//echo $query;
if (!$result = @mysqli_query($conn,$query)) {
error_log("Failed to exuecute checklist query:". mysqli_error($conn) . " Failing Query:". $query);
exit(mysqli_error($conn));
}
?>