<?php
	include "koneksi.php";
	//$daily=$_POST["daily"];
	//$progres=$_POST["progres"];
	//$mhbid=$_POST["mhbid"];
	$firstname=$_POST["firstname"];
	$lastname=$_POST["lastname"];
	$handle=$_POST["handle"];
	$remarks=$_POST["remarks"];
    //echo "daily".$daily;
	//echo "progres".$progres;
	//echo "mhbid".$mhbid;
	$tanggal = date('m-d-Y');
	

	
				  
	
foreach($_POST['table'] as $i => $table){
	$firstname = $_POST['firstname'][$i];
	$lastname = $_POST['lastname'][$i];
	$handle = $_POST['handle'][$i];
	$remarks = $_POST['remarks'][$i];
	
		echo "firstname = ".$firstname."<br>";
	echo "lastname = ".$lastname."<br>";
	echo "handle = ".$handle."<br>";
	echo "remarks = ".$remarks."<br>";
	echo "insertRow = ".$insertRow."<br>";

}
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Ambil Data yang Dikirim dari Form
   // $nama_file = $_FILES['gambar']['name'];
    //$ukuran_file = $_FILES['gambar']['size'];
    //$tipe_file = $_FILES['gambar']['type'];
    //$tmp_file = $_FILES['gambar']['tmp_name'];
	
	//echo "foto :".$nama_file;
	
	//if ($nama_file == NULL)//foto kosong
	//{
		//$level=$_SESSION["Level"];
			//$q="SELECT * FROM user WHERE id='". $_SESSION["UserID"] ."'";
			//$res=mysqli_query($conn,$q);
			//$dataUser=mysqli_fetch_assoc($res);
			
			
			//$nik = $dataUser["nik_data_karyawan"];
			//$nama = $dataUser["nama"];
			
		//	$d="SELECT * FROM data_karyawan WHERE nik = '$nik'";
			//$res1 = mysqli_query($conn,$d);
			//$data1=mysqli_fetch_assoc($res1);
			
		//	$departement = $data1["departement"];
			//echo "departement = ".$departement."<br>";
			
			//echo "d = ".$d."<br>";
		//echo "nik".$nik."<br>";
		//echo "nama".$nama."<br>";
		//$q = "INSERT into daily_report (nik,isi,nama,tanggal_upload,progres,mhb_id,departement)
			//  VALUE ('$nik','$daily','$nama','$tanggal','$progres','$mhbid','$departement')";
		//$result = mysqli_query($conn, $q);
		//if($result)
		//{
			//echo "berhsil input"."<br>";
			//echo $q;
			//header("location:tambahDailyReport.php?p=1");
		//}
		//else
		//{
			//echo "gagal input"."<br>";
			//echo $q;
			//header("location:tambahDailyReport.php?p=2");
		//}
	//}
	//else // foto terisi
	//{
		//echo "foto terisi";
			//	// Set path folder tempat menyimpan gambarnya
		//$path = "fotoDailyReport/".$nama_file;
		//if($tipe_file == "image/jpeg" || $tipe_file == "image/png")
		//{ // Cek apakah tipe file yang diupload adalah JPG / JPEG / PNG
		  //// Jika tipe file yang diupload JPG / JPEG / PNG, lakukan :
		 // if($ukuran_file <= 1000000){ // Cek apakah ukuran file yang diupload kurang dari sama dengan 1MB
			//// Jika ukuran file kurang dari sama dengan 1MB, lakukan :
			//// Proses upload
			//if(move_uploaded_file($tmp_file, $path))
			//{ // Cek apakah gambar berhasil diupload atau tidak
			 // // Jika gambar berhasil diupload, Lakukan :  
			  //// Proses simpan ke Database
			  
			//  $level=$_SESSION["Level"];
				//$q="SELECT * FROM user WHERE id='". $_SESSION["UserID"] ."'";
				//$res=mysqli_query($conn,$q);
				//$dataUser=mysqli_fetch_assoc($res);
				
				////echo " ".$dataUser["nik_data_karyawan"];
				//$nik = $dataUser["nik_data_karyawan"];
				//$nama = $dataUser["nama"];
				
				//$q = "INSERT into daily_report (nik,isi,nama,tanggal_upload,nama_gambar,progres,mhb_id,departement)
					//VALUE ('$nik','$daily','$nama','$tanggal','$nama_file','$progres','$mhbid','$departement')";
				//$result = mysqli_query($conn, $q);
				//if($result)
				//{
					//echo "Data dan foto berhasil masuk";
					//header("location:tambahDailyReport.php?p=1");
				//}
				//else
				//{
					//header("location:tambahDailyReport.php?p=2");
					////die("Error");
					//echo "Gagal";
				//}
			//}
			//else
			//{
			  //// Jika gambar gagal diupload, Lakukan :
		  
			  //header("location:tambahDailyReport.php?p=3");
			//}
		  //}
		  //else
		  //{
			//// Jika ukuran file lebih dari 1MB, lakukan :
		   
			//header("location:tambahDailyReport.php?p=4");
		  //}
		//}
		//else
		//{
		  //// Jika tipe file yang diupload bukan JPG / JPEG / PNG, lakukan :

		 // header("location:tambahDailyReport.php?p=5");
		//}
	//}
	
?>