<?php
include '../../connect.php';
session_start();

$kadPengenalan=$_GET["kadPengenalan"];

$nama =strtoupper($_POST['nama']);
$noTel =$_POST['noTel'];
$email =strtoupper($_POST['email']);

date_default_timezone_set("Asia/Kuala_Lumpur");			
$date=date('Y-m-d');
$time=date('H:i:sa');

	if($nama =="" || $kadPengenalan == "" || $noTel =="" ||  $email == "" )
	{
		mysqli_commit($conn);
		echo "<script>alert('Sila lengkapkan maklumat pendaftaran. ');";
		echo "window.location.href = '../ubahsuaiPemandu.php?kadPengenalan=$kadPengenalan';</script>";
		exit;
		
	}
	else
	{
			
			$query="UPDATE `pemandu` SET nama_pemandu='".$nama."', noTel='".$noTel."', email='".$email."' WHERE pemanduID='".$kadPengenalan."'";
			$strQuery = mysqli_query($conn,$query);
			
			if($strQuery) 
				{								
					echo "<script>alert('Kemaskini berjaya!');";
					echo "window.location.href = '../daftarPemandu.php';</script>";
					exit;	
					
				}
				else
				{
					mysqli_commit($conn);
					echo "<script>alert('Sila lengkapkan maklumat pendaftaran. ');";
					echo "window.location.href = '../ubahsuaiPemandu.php?kadPengenalan=".$kadPengenalan."';</script>";
					exit;
					
				}
		
	}
?>

