<?php
        // where is your config file stored?
	include ("config.php");

	
	
	$Employee_ID = htmlspecialchars(trim($_POST['EmployeeID']));
	$Name = htmlspecialchars(trim($_POST['Name']));
	$Gender = htmlspecialchars(trim($_POST['Gender']));
	$Boarding_Point  = htmlspecialchars(trim($_POST['country']));
	$Telephone_No = htmlspecialchars(trim($_POST['TelephoneNo']));
	$Department  = htmlspecialchars(trim($_POST['Department']));
	$Bus_No= htmlspecialchars(trim($_POST['country_ID']));
	if(!isset($_POST['TelephoneNo'])	)
	{
	echo"Mob Null";
	}
	else
	{
	 echo"Mob not Null";
	}
	  
	
	$ans="select EmployeeId from staff where EmployeeId=$Employee_ID";
   $checkbusquer='select BusNumber from stop where StopName="'.$Boarding_Point.'"';
	$ans=mysql_query($checkbusquer);
	$res=mysql_fetch_array($ans);
	if(mysql_num_rows($ans)<=0)
	{
	  echo "nobus";
	  exit();
	} 
	else
	{
		$Bus_No=$res['BusNumber'];
    } 

    if(mysql_num_rows(mysql_query($ans))>0)
      {
	   echo "yes"; //Employee Number all ready exists
	   }
	else
		{
		echo "no"; //New Employee student details
		//now set the session from here if needed
		//$_SESSION['u_name']=$user_name; 
		$addClient  = "INSERT INTO staff(EmployeeId,Name,Department,TeleNo,Gender,BusNumber,StopName,Status) VALUES ('$Employee_ID','$Name','$Department','$Telephone_No','$Gender','$Bus_No','$Boarding_Point','1')";
    mysql_query($addClient) or die(mysql_error());
	}
	
	


?>