<?php
	
	
	include "koneksi.php";
	$scan=mysqli_real_escape_string($conn,$_GET["scan"]);
	
	$nik=$_POST["nik"];
	$nama_karyawan=$_POST["nama_karyawan"];
	$alasan=$_POST["alasan"];

	$query = "INSERT INTO data_izin (nik,scan_date,alasan_izin)
							VALUE
							('$nik','$scan','$alasan')";
	$qupdate = "UPDATE data_izin
				SET izin='izin' WHERE scan_date='$scan'";
							
	echo $query . "</br>";
	echo $qupdate;
	//$query2 = "INSERT INTO data_pasangan (nama,jenis_kelamin,tempat_lahir,tanggal_lahir,nik_pasangan)
		//					VALUE ('$namapasangan','$jeniskelamin','$tempatlahir','$tanggallahirpasangan','$nikpasangan','$nikpasangan')";
	$resultInsert = mysqli_query($conn, $query);
	$resultUpdate = mysqli_query($conn, $qupdate);
	//$result2 = mysqli_query($conn, $query2);

	//echo "query = " . $query . "</br>";
	//echo "query2 = " . $query2 . "</br>";
	
	if($resultInsert AND $resultUpdate)
	{
		//echo "Data periode berhasil masuk";
		header("location:dataizin.php?pesan=berhasilInput");
	}
	else
	{
		header("location:dataizin.php?pesan=gagalInput");
		die("Error");
	}
	//echo "namanya : " . $nama;
	
	//$q="INSERT INTO kriteria (nama,id_kategori) VALUES ('$nama','$id')";
	//mysqli_query($conn,$q);
	//header("location:kriteria.php?p=1&id=".$id);
	
	//echo $q;
?>