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

30 lines
1.4 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,'SOP Documents','SAVE','save_sop_document.php');
$id = $_POST['id'];
//$site =$_POST['site'];
//$sop_number = $_POST['sop_number'];
//$rev_no = $_POST['rev_no'];
//$unit = $_POST['unit'];
$file_path=$_FILES['file_medical_exam']['tmp_name']; //pdf is the name of the input type where we are uploading files
$file_type=$_FILES['file_medical_exam']['type'];
$file_size=$_FILES['file_medical_exam']['size'];
$file_name=$_FILES['file_medical_exam']['name'];
$id=$_REQUEST['id'];
if ($file_name != ""){
$data=mysqli_real_escape_string($conn,file_get_contents($file_path));
echo $query="INSERT INTO sop_document SET medical_doc_desc='".$_POST['medical_exam_document']."',medical_doc = '".$data."',medical_doc_name='".$file_name."',medical_doc_type='".$file_type."',sop_number='".$_POST['sop_number']."',site='".$_POST['site']."',rev_no='".$_POST['rev_no']."',last_renewal_date='".$_POST['last_renewal_date']."',new_renewal_date='".$_POST['new_renewal_date']."',unit='".$_POST['unit']."',id='".$id."'";
$result = mysqli_query($conn,$query);
}
?>