<?php
        // where is your config file stored?
	include ("config.php");
	$HadmnNo= htmlspecialchars(trim($_POST['HadmnNo']));
	$Admission_No = htmlspecialchars(trim($_POST['AdmissionNo']));
	$Name = htmlspecialchars(trim($_POST['Name']));
	$Gender = htmlspecialchars(trim($_POST['Gender']));
	$Boarding_Point  = htmlspecialchars(trim($_POST['country']));
	$Telephone_No = htmlspecialchars(trim($_POST['TelephoneNo']));
	$Course  = htmlspecialchars(trim($_POST['Course']));
	$Semester = htmlspecialchars(trim($_POST['Semester']));
	$Bus_No= htmlspecialchars(trim($_POST['country_ID']));
	$ans='select StudentId from student where AdmissionNo="'.$HadmnNo.'"' ;
	//echo $ans;
$result_disp = mysql_query($ans);
$query_data = mysql_fetch_array($result_disp);
$resu=$query_data['StudentId'];
$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'];
    } 
//$chk='select * from student where AdmissionNo="'.$AdmissionNo.'"' ;
//    if(mysql_num_rows(mysql_query($chk))>0)
//      {
//	   echo "yes"; //Admission Number all ready exists
//	   }
//	else
//		{
//		echo "no"; //New student details
		//now set the session from here if needed
		//$_SESSION['u_name']=$user_name; 
		$updateClient  ="update student set Name='$Name',AdmissionNo='$Admission_No',Gender='$Gender',TeleNo='$Telephone_No',Batch='$Course',Semester='$Semester',BusNumber='$Bus_No',StopName='$Boarding_Point' where StudentId='$resu'";
    mysql_query($updateClient) or die(mysql_error());	
	//}
	print_r($_POST);
	?>