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

	//$q="UPDATE merk_sparepart SET nama='$nama' WHERE id='$id'";
	//mysqli_query($conn,$q);
	//header("location:merksparepart.php?p=1");
	
	// if (empty($nama))
	// {
	// 	//header("location:updategajikaryawan.php?p=1&id=".$id);
	// }
	// else
	// {
		$q="SELECT * FROM data_karyawan WHERE id=$id"; 
		$res=mysqli_query($conn,$q);
		echo "query : " .$q;
		
		if ($res)
		{
			//$q="INSERT INTO kendaraan (nama,id_merkMotor) VALUES ('$nama','$id')";
			$q="UPDATE data_karyawan SET no_bpjs_kesehatan='$no_bpjs_kesehatan' WHERE id=$id";
			//$update = $conn->query($q);
			$update = mysqli_query($conn, $q);
			echo "query : " . $q;
			if (! $update)
			{
				echo "gagal  update";
				header("location:datanomorbpjpensiun.php");
			}
			else if ($update)
			{
				
				echo "berhasil update";
				header("location:datanomorbpjpensiun.php");
			}
			//header("location:updategajikaryawan.php?p=2");
		}
		else
		{
			echo "gagal update ";
		}
		
	//}
?>