<?php session_start();
if(empty($_SESSION['id'])):
header('Location:../index.php');
endif;

include('../dist/dbcon.php');

	
	if(isset($_POST['submit'])) { 
								
									$id = $_SESSION['id'];
									  $filename = $_FILES["filename"]["name"];
									 
									  $transname = $_POST['reportname'];
									   $transtype = $_POST['note'];
									  
									
									  move_uploaded_file($_FILES["filename"]["tmp_name"],"media/".$_FILES["filename"]["name"]);
									
									  

									
mysqli_query($con,"INSERT INTO userreports(reportname,note,filename,userid,status,date,techfilename) VALUES ('$transname','$transtype','$filename','$id','pending','0000-00-00','')")or die(mysqli_error($con)); 
echo "<script>alert('Hydrocheck Uploaded Successfully Reports');</script>";
									 	echo "<script>document.location='report.php'</script>";  
									}
									?>