<?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 (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, "fotoFormMHB-FR-PRO-D001-01/".$file_name);
					$gambar[$i] = $file_name;				
				}
				$gambar1 = $gambar[0];
				$gambar2 = $gambar[1];
				$gambar3 = $gambar[2];
				$gambar4 = $gambar[3];
				$gambar5 = $gambar[4];
				
				$gambar6 = $gambar[5];
				$gambar7 = $gambar[6];
				$gambar8 = $gambar[7];
				$gambar9 = $gambar[8];
				$gambar10 = $gambar[9];
				
				$gambar11 = $gambar[10];
				$gambar12 = $gambar[11];
				$gambar13 = $gambar[12];
				$gambar14 = $gambar[13];
				$gambar15 = $gambar[14];
				
				$gambar16 = $gambar[15];
				$gambar17 = $gambar[16];
				$gambar18 = $gambar[17];
				$gambar19 = $gambar[18];
				$gambar20 = $gambar[19];
				
				echo "gambar1 = ".$gambar1."<br>";
				echo "gambar2 = ".$gambar2."<br>";
				echo "gambar3 = ".$gambar3."<br>";
				echo "gambar4 = ".$gambar4."<br>";
				echo "gambar5 = ".$gambar5."<br>";
				
				echo "gambar6 = ".$gambar6."<br>";
				echo "gambar7 = ".$gambar7."<br>";
				echo "gambar8 = ".$gambar8."<br>";
				echo "gambar9 = ".$gambar9."<br>";
				echo "gambar10 = ".$gambar10."<br>";
				
				echo "gambar11 = ".$gambar11."<br>";
				echo "gambar12 = ".$gambar12."<br>";
				echo "gambar13 = ".$gambar13."<br>";
				echo "gambar14 = ".$gambar14."<br>";
				echo "gambar15 = ".$gambar15."<br>";
				
				echo "gambar16 = ".$gambar16."<br>";
				echo "gambar17 = ".$gambar17."<br>";
				echo "gambar18 = ".$gambar18."<br>";
				echo "gambar19 = ".$gambar19."<br>";
				echo "gambar20 = ".$gambar20."<br>";
				
				//mysqli_query($conn,"UPDATE fom_dissasembly_checklist SET('','$mhb_id','1','$tanggal_periksa_kelengkapan_cylinder',
														   
					//									   '','','','','','','','','','',
						//								   '','','','','','','','','','',
														   
							//							   '$gambar[0]','$gambar[1]','$gambar[2]','$gambar[3]','$gambar[4]',
								//						   '$gambar[5]','$gambar[6]','$gambar[7]','$gambar[8]','$gambar[9]',
														   
									//					   '$gambar[10]','$gambar[11]','$gambar[12]','$gambar[13]','$gambar[14]',
										//				   '$gambar[15]','$gambar[16]','$gambar[17]','$gambar[18]','$gambar[19]',
														   
														 
														   
											//			   '','','','','','','','',
														   
												//		   '')
														   
													//	   WHERE no_mhb_barang_job =$mhb_id");
													
													
				$q = "UPDATE fom_dissasembly_checklist
                      SET gambarValvePosisi1='$gambar1', gambarValvePosisi2='$gambar2', gambarValvePosisi3='$gambar3', gambarValvePosisi4='$gambar4', gambarValvePosisi5='$gambar5',
					      gambarValvePosisi6='$gambar6', gambarValvePosisi7='$gambar7', gambarValvePosisi8='$gambar8', gambarValvePosisi9='$gambar9', gambarValvePosisi10='$gambar10',
                          gambarValvePosisi11='$gambar11', gambarValvePosisi12='$gambar12', gambarValvePosisi13='$gambar13', gambarValvePosisi14='$gambar14', gambarValvePosisi15='$gambar15',
					      gambarValvePosisi16='$gambar16', gambarValvePosisi17='$gambar17', gambarValvePosisi18='$gambar18', gambarValvePosisi19='$gambar19', gambarValvePosisi20='$gambar20'                            
						  
                WHERE no_mhb_barang_job=$mhb_id"; 									
													
				
                //header("location:cleaningAndDaT4.php?p=1&d=$mhb_id");
                $result = mysqli_query($conn, $q);
				if($result)
				{
					echo "<br>"."query ".$q."<br>";	
					echo "Data berhasil masuk";
					header("location:cleaningAndDat4.php?p=1&d=$mhb_id");
				}
				else
				{
					header("location:cleaningAndDat3.php?p=2&d=$mhb_id");
					//die("Error");
				}				

			}
			else
			{
				echo "Gambar tidak ada";
			}
		}	
    
?>