<?php
	include "koneksi.php";
	
	$mhb_id=mysqli_real_escape_string($conn,$_GET["id"]);
    echo "ini mhb id :".$mhb_id."<br>";	
    $tanggal_periksa_kelengkapan_cylinder = date('d / M / y');
    $cuci=$_POST['cuci'];
    echo "<br>".$cuci;
  
	if ($cuci == 1)//sudah dicuci
	{
		if (isset($_POST["kirim"])) {
			$jumlah = count($_FILES['gambar']['name']);
			//$jumlah2 = count($_FILES['gambar2']['name']);
			if ($jumlah > 0) 
			{
				$gambar = array();
				for ($i=0; $i < $jumlah; $i++) { 
					$file_name = $_FILES['gambar']['name'][$i];
					$tmp_name = $_FILES['gambar']['tmp_name'][$i];				
					move_uploaded_file($tmp_name, "tes/".$file_name);
					$gambar[$i] = $file_name;				
				}
				mysqli_query($conn,"INSERT INTO fom_dissasembly_checklist VALUES('','$mhb_id','1','$tanggal_periksa_kelengkapan_cylinder',
														   
														   '$gambar[0]','$gambar[1]','$gambar[2]','$gambar[3]','$gambar[4]','')");
													   
				echo "Berhasil Upload 1";
                header("location:cleaningAndDaT3.php?p=1&d=$mhb_id");// ini tambahkan $ id_mhb				

			}
			else
			{
				echo "Gambar tidak ada";
			}
		}
	}
    else if ($cuci == 2)
	{
		//kembali ke cleaning and dat tanpa proses
		header("location:cleaningAndDaT.php?p=6");
	}	
    
?>