<?php 
##################################################################
#  This is the basic that can be called  within the web application
#  Include this after the configuration file on every page
#  File name: functions.php
##################################################################

//Call the configuration file
include('configuration.php');


	//function get_user()
//	{
//		$user_id = $_SESSION['id'];
//		return $user_id;
//	}





//not functional
//Get Current User's ID fro sessionif i need t use this in startic manner
	function get_user_id()
	{
		$pn = $_COOKIE['lstoo'];
		return $pn;
	}




//Function to fetch user's Rool
	function get_user_role($user_id)
	{
		$result = mysql_query("SELECT * FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$role_id = $row['role_id'];

	return $role_id;
	}

//Function to fetch User Last IP
	function get_last_login_ip($user_id)
	{
		$result = mysql_query("SELECT * FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$last_login_ip = $row['last_login_ip'];

	return $last_login_ip;
	}

//Function to fetch students_nce Lat login date
	function get_last_login($user_id)
	{
		$result = mysql_query("SELECT DATE_FORMAT(last_login, '%b %e,%y  %l:%i:%p') as user_lastlogindate  FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$last_login = $row['user_lastlogindate'];
		
	return $last_login;
	}

//Functions to fetch user's Full name
	function get_user_fullname($user_id)
	{
		$result = mysql_query("SELECT * FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$first_name = $row['first_name'];
		$other_names = $row['other_names'];
		
		$user_fullname =  $other_names. " " . $first_name;

	return $user_fullname;
	}
	
	
//Function to fetch user name
	function get_user_username($user_id)
	{
		$result = mysql_query("SELECT * FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$username = $row['username'];
		

	return $username;
	}
	
	
	//Function to fetch matric number
	function get_user_mat_no($user_id)
	{
		$result = mysql_query("SELECT number FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$admission_number = $row['number'];
		

	return $admission_number;
	}
	
		//Function to fetch application number
	function get_user_application_number($user_id)
	{
		$result = mysql_query("SELECT application_number FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$v = $row['application_number'];
		

	return $v;
	}
	
	
	//function that gets  department base on user id
	  function  get_user_school_id($user_id)
	  {	
		  $result = mysql_query("SELECT school_id FROM students_nce WHERE id = '$user_id'"); 
			  $row = mysql_fetch_assoc($result);
			  $department_id = $row['school_id'];
	  
		  return $department_id;
		  
	  }
	
	
	//function that gets  department base on user id
	  function  get_user_department_id($user_id)
	  {	
		  $result = mysql_query("SELECT department_id FROM students_nce WHERE id = '$user_id'"); 
			  $row = mysql_fetch_assoc($result);
			  $department_id = $row['department_id'];
	  
		  return $department_id;
		  
	  }
	  
	  
	  //function that gets programme_id base on user id
	  function  get_user_programme_id($user_id)
	  {	
		  $result = mysql_query("SELECT programme_id FROM students_nce WHERE id = '$user_id'"); 
			  $row = mysql_fetch_assoc($result);
			  $programme_id = $row['programme_id'];
	  
		  return $programme_id;
		  
	  }

	
	
	 //function that gets programme type _id base on user id
	  function  get_user_programme_type_id($user_id)
	  {	
		  $result = mysql_query("SELECT type_id FROM students_nce WHERE id = '$user_id'"); 
			  $row = mysql_fetch_assoc($result);
			  $v = $row['type_id'];
	  
		  return $v;
		  
	  }
	
	
//Function to fetch email
	function get_user_email($user_id)
	{
		$result = mysql_query("SELECT email FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$email = $row['email'];

	return $email;
	}
	
	
	
	//Function to fetch phone number
	function get_user_phone_no($user_id)
	{
		$result = mysql_query("SELECT phone_no FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$ph = $row['phone_no'];

	return $ph;
	}
	
		//Function to fetch phone number
	function get_user_sign($user_id)
	{
		$result = mysql_query("SELECT sign FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$sn = $row['sign'];

	return $sn;
	}
	
	
	//function dat get user security id  by id 
	function get_security_id($user_id)
	{
		$q = "SELECT security_id FROM students_nce WHERE id = '$user_id' ";
		$r = mysql_query($q);
		$row = mysql_fetch_assoc($r);
		
		return $row['security_id'];
		
		
	}
	
	
	//function dat get user address 
	function get_user_address($user_id)
	{
		$q = "SELECT address FROM students_nce WHERE id = '$user_id'";
		$r = mysql_query($q);
		$row = mysql_fetch_assoc($r);
		
		return $row['address'];
		
		
	}
	
	
	//function dat get user image by id 
	function get_user_image($user_id)
	{
	$q = "SELECT image FROM students_nce WHERE id = '$user_id'";
	$r = mysql_query($q);
	$row = mysql_fetch_assoc($r);
	
	return $row['image'];
	
	
	}
	
	
	
	//function dat get user matric number
	function get_matric_no($user_id)
	{
	$q = "SELECT number FROM students_nce WHERE id = '$user_id' ";
	$r = mysql_query($q);
	$row = mysql_fetch_assoc($r);
	
	return $row['number'];
	
	
	}
	
	//Function to fetch role name
	function get_role_title($role_id)
	{
		$result = mysql_query("SELECT * FROM roles WHERE id = '$role_id'"); 
		$row = mysql_fetch_assoc($result);
		$role_title = $row['role_title'];
		
	return $role_title;
	}

	//Functions to fetch user's first name
	function get_user_first_name($user_id)
	{
		$result = mysql_query("SELECT first_name FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$first_name = $row['first_name'];
	

	return $first_name;
	}
	
	//Functions to fetch user's other names
	function get_user_other_names($user_id)
	{
		$result = mysql_query("SELECT other_names FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$on = $row['other_names'];
	

	return $on;
	}
	
	
	//Functions to fetch user's middle name
	function get_user_middle_name($user_id)
	{
		$result = mysql_query("SELECT middle_name FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$on = $row['middle_name'];
	

	return $on;
	}
	
	
	//Functions to fetch user's marital status
	function get_user_ms($user_id)
	{
		$result = mysql_query("SELECT marital_status FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$ms = $row['marital_status'];
	

	return $ms;
	}
	
	
		//Functions to fetch user's gender
	function get_user_gender($user_id)
	{
		$result = mysql_query("SELECT gender FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$gd = $row['gender'];
	

	return $gd;
	}
	
	
	
		//Functions to fetch user's religion
	function get_user_religion($user_id)
	{
		$result = mysql_query("SELECT religion FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$religion = $row['religion'];
	

	return $religion;
	}
	
	
	
		//Functions to fetch user's place of birth
	function get_user_pob($user_id)
	{
		$result = mysql_query("SELECT place_of_birth FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$v = $row['place_of_birth'];
	

	return $v;
	}
	
	
	
//Function to fetch user level
	function get_user_level($id)
	{
		$result = mysql_query("SELECT level FROM students_nce WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$level = $row['level'];
		
	return $level;
	}
	
	
	
	//function fetch user day
	function get_user_day($id)
	{
		$result = mysql_query("SELECT day FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$day = $row['day'];
		
		return $day;
	}
	
	
	
	
	//function fetch user month
	function get_user_month($id)
	{
		$result = mysql_query("SELECT month FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$month = $row['month'];
		
		return $month;
	}
	
	
	
	//function fetch user year
	function get_user_year($id)
	{
		$result = mysql_query("SELECT year FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$year = $row['year'];
		
		return $year;
	}
	
	
	//function fetch user nationality
	function get_user_nationality($id)
	{
		$result = mysql_query("SELECT nationality FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$n = $row['nationality'];
		
		return $n;
	}
	
	
	
	//function fetch user country
	function get_user_country_id($id)
	{
		$result = mysql_query("SELECT country_id FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$country_id = $row['country_id'];
		
		return $country_id;
	}
	
	
	//function fetch user state id
	function get_user_state_id($id)
	{
		$result = mysql_query("SELECT state_id FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$sid = $row['state_id'];
		
		return $sid;
	}
	
	//function fetch user lga id
	function get_user_lga_id($id)
	{
		$result = mysql_query("SELECT lga_id FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$lid = $row['lga_id'];
		
		return $lid;
	}
	
	
	
	
	//function get user permanent address
	
	function get_user_permanent_address($id)
	{
		$result = mysql_query("SELECT permanent_address FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['permanent_address'];
		
		
		return $v;
	}
	
	
	
	
	//function get user guardian_name
	function get_user_guardian_name($id)
	{
		$result = mysql_query("SELECT guardian_name FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['guardian_name'];
		
		
		return $v;
	}
	
	
	
	
	//function get user guardian_relationship
	function get_user_guardian_relationship($id)
	{
		$result = mysql_query("SELECT guardian_relationship FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['guardian_relationship'];
		
		
		return $v;
	}


		//function get guardian_tel
	function get_user_guardian_tel($id)
	{
		$result = mysql_query("SELECT guardian_tel FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['guardian_tel'];
		
		
		return $v;
	}
	
	
	
	//function get guardian_address
	function get_user_guardian_address($id)
	{
		$result = mysql_query("SELECT guardian_address FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['guardian_address'];
		
		
		return $v;
	}	
	
	
	//function get user sponsorhip type
	function get_user_sponsorship_type($id)
	{
		$result = mysql_query("SELECT sponsorship_type FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['sponsorship_type'];
		
		
		return $v;
	}
	

	//function get user sponsorhip type
	function get_user_sponsorhip_name($id)
	{
		$result = mysql_query("SELECT sponsorship_name FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['sponsorship_name'];
		
		
		return $v;
	}
	
	
	//function get user sponsorhip address
	function get_user_sponsorship_address($id)
	{
		$result = mysql_query("SELECT sponsorship_address FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['sponsorship_address'];
		
		
		return $v;
	}
	


//function fetch user programme type
	function get_user_programme_type($id)
	{
		$result = mysql_query("SELECT type_id FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['type_id'];
		
		
		return $v;
	}

//function fetch user study_mode
	function get_user_study_mode($id)
	{
		$result = mysql_query("SELECT cart_id FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['cart_id'];
		
		
		return $v;
	}

//function fetch user entry_mode
	function get_user_entry_mode($id)
	{
		$result = mysql_query("SELECT mode_of_entry FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['mode_of_entry'];
		
		
		return $v;
	}
	
	
	//function fetch user entry_year
	function get_user_entry_year($id)
	{
		$result = mysql_query("SELECT entry_year FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['entry_year'];
		
		
		return $v;
	}
	
	
	//function fetch user get_user_award_in_view
	function get_user_award_in_view($id)
	{
		$result = mysql_query("SELECT award_in_view FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['award_in_view'];
		
		
		return $v;
	}
	
	
	
	//function fetch user get_user_activities
	function get_user_activities($id)
	{
		$result = mysql_query("SELECT activities FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['activities'];
		
		
		return $v;
	}
	
		//function fetch user get_highest qualififcation
	function get_user_highest_qualification($id)
	{
		$result = mysql_query("SELECT highest_qualification FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['highest_qualification'];
		
		
		return $v;
	}
	
		//function fetch user get obtained_institution
	function get_user_institution_obtained($id)
	{
		$result = mysql_query("SELECT institution_obtained FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['institution_obtained'];
		
		
		return $v;
	}
	
		//function fetch user get first_degree
	function get_user_first_degree($id)
	{
		$result = mysql_query("SELECT first_degree FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['first_degree'];
		
		
		return $v;
	}
	
	
	
	//function fetch user health status
	function get_user_h_status($id)
	{
		$result = mysql_query("SELECT H_status FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['H_status'];
		
		return $v;
	}
	
	
	
	//function fetch user disability
	function get_user_disability($id)
	{
		$result = mysql_query("SELECT disability FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['disability'];
		
		return $v;
	}
	
	//function fetch user blood group
	function get_user_bg($id)
	{
		$result = mysql_query("SELECT blood_type FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['blood_type'];
		
		
		return $v;
	}
	
	
	
	
	
	//function fetch user medication
	function get_user_medication($id)
	{
		$result = mysql_query("SELECT medi FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['medi'];
		
		return $v;
	}
	
	
	//function fetch user jamb score
	function get_user_jamb_score($id)
	{
		$result = mysql_query("SELECT jambscore FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['jambscore'];
		
		return $v;
	}
	
	
	
	//function fetch user jamb number
	function get_user_jamb_number($id)
	{
		$result = mysql_query("SELECT jamb_number FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['jamb_number'];
		
		return $v;
	}
	


	//function fetch user de number
	function get_user_de_number($id)
	{
		$result = mysql_query("SELECT de_number FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['de_number'];
		
		return $v;
	}
	
	
	//function fetch user de qualification
	function get_user_de_qualification($id)
	{
		$result = mysql_query("SELECT de_qualification FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['de_qualification'];
		
		return $v;
	}
	
	
	
	//function fetch user de grade
	function get_user_de_grade($id)
	{
		$result = mysql_query("SELECT de_grade FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['de_grade'];
		
		return $v;
	}
	
	
	
	//function fetch user credential
	function get_user_credential($id)
	{
		$result = mysql_query("SELECT pdf_file FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['pdf_file'];
		
		return $v;
	}
	
	
		//function fetch user minimum credit load
	function get_user_min_credit_load($id)
	{
		$result = mysql_query("SELECT minimum_credit_load FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['minimum_credit_load'];
		
		return $v;
	}
	
	
		//function fetch user maximum credit load
	function get_user_max_credit_load($id)
	{
		$result = mysql_query("SELECT maximum_credit_load FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['maximum_credit_load'];
		
		return $v;
	}
	
	//function fetch user programme admission serial no
	function get_user_programme_admission_no($id)
	{
		$result = mysql_query("SELECT admission_serial_no FROM students_nce WHERE id = '$id'");
		$row = mysql_fetch_assoc($result);
		$v = $row['admission_serial_no'];
		
		
		return $v;
	}
	
	
	//function fetch put user admission no
	function put_admission_serial_no($id)
	{
		
		if(get_user_programme_admission_no($id) == '')
		{
			$admission_sn = generate_students_admission_serial_number();
			
			mysql_query("UPDATE students_nce  SET admission_serial_no = '$admission_sn' WHERE id = '$id'");
			
			
		}
		else
		{
			$admission_sn = get_user_programme_admission_no($id);
		}
		
		
		return $admission_sn;
	}
	//end of generate adm serialno
	
	
	//generate applicant admision letter no.
	function generate_students_admission_serial_number()
	{
		$result = mysql_query("SELECT * FROM applicants_generate_admission_serial_number");
		while($row = mysql_fetch_array($result))
		{
			$g_code = $row['code'];
		}
		
		//add 1 to $g_code and tek to d db
		$g_coded = $g_code + 1;
		
		mysql_query("UPDATE applicants_generate_admission_serial_number  SET code = '$g_coded'");
		
		$len_g_coded  = strlen($g_coded);
		
		if($len_g_coded == '1')
		{
			$code = '000'.$g_coded;
		}
		else if($len_g_coded == '2')
		{
			$code = '00'.$g_coded;
		}
		else if($len_g_coded == '3')
		{
			$code = '0'.$g_coded;
		}
		else
		{
			$code = $g_coded;
		}
		
		
		return $code;
		
		
		
		
		
	}
	//end of function geerate admission serial no

	
	
	
	
//function select marital status 
function select_marital_status($st)
{
		
		if ($st == 'single')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="single" selected > Single</option>';
			$output .= '<option value="married" > Married</option>';
			$output .= '<option value="divorced" >Divorced</option>';
			$output .= '<option value="widowed" >Widowed</option>';
		
			
		}
		else if ($st == 'married')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="single"  > Single</option>';
			$output .= '<option value="married" selected> Married</option>';
			$output .= '<option value="divorced" >Divorced</option>';
			$output .= '<option value="widowed" >Widowed</option>';
		
			
		}
		else if ($st == 'divorced')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="single"  > Single</option>';
			$output .= '<option value="married" > Married</option>';
			$output .= '<option value="divorced" selected >Divorced</option>';
			$output .= '<option value="widowed" >Widowed</option>';
		
			
		}
		else if ($st == 'widowed')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="single"  > Single</option>';
			$output .= '<option value="married" > Married</option>';
			$output .= '<option value="divorced"  >Divorced</option>';
			$output .= '<option value="widowed" selected >Widowed</option>';
		
			
		}
		else
		{
		
			$output = '<option value="0" selected> -- Please Select --</option>';
			$output .= '<option value="single"  > Single</option>';
			$output .= '<option value="married" > Married</option>';
			$output .= '<option value="divorced" >Divorced</option>';
			$output .= '<option value="widowed" >Widowed</option>';
		
		}

	return $output;

}
//end of select marrital status



//function select gender
function select_gender($gd)
{
		
		if ($gd == 'Male')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="Male" selected > Male</option>';
			$output .= '<option value="Female" > Female</option>';
		
			
		}
		else if ($gd == 'Female')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="Male"> Male</option>';
			$output .= '<option value="Female" selected > Female</option>';
		
			
		}
		else
		{
		
			$output = '<option value="0"  selected  > -- Please Select --</option>';
			$output .= '<option value="Male"> Male</option>';
			$output .= '<option value="Female"> Female</option>';
		}

	return $output;

}
//end of select gender








//function select religion
function select_religion($r)
{
		
		if ($r == '1')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" selected > Islam</option>';
			$output .= '<option value="2" > Christianity</option>';
			$output .= '<option value="3" > Traditional</option>';
			$output .= '<option value="4" > Others</option>';
		
			
		}
		else if ($r == '2')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1"  > Islam</option>';
			$output .= '<option value="2" selected > Christianity</option>';
			$output .= '<option value="3" > Traditional</option>';
			$output .= '<option value="4" > Others</option>';
		
			
		}
		else if ($r == '3')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1"  > Islam</option>';
			$output .= '<option value="2" > Christianity</option>';
			$output .= '<option value="3" selected  > Traditional</option>';
			$output .= '<option value="4" > Others</option>';
		
			
		}
		else if ($r == '4')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="1"> Islam</option>';
			$output .= '<option value="2" > Christianity</option>';
			$output .= '<option value="3" > Traditional</option>';
			$output .= '<option value="4"  selected > Others</option>';
		
			
		}
		else
		{
		
			$output = '<option value="0"  selected> -- Please Select --</option>';
			$output .= '<option value="1"> Islam</option>';
			$output .= '<option value="2" > Christianity</option>';
			$output .= '<option value="3" > Traditional</option>';
			$output .= '<option value="4"  > Others</option>';
		}

	return $output;

}
//end of select religion


//function show religion
function show_religion($r)
{
		
		if ($r == '1')
		{
			
			$output .= 'Islam';
			
		}
		else if ($r == '2')
		{
			
			$output .= 'Christianity';
			
			
		}
		else if ($r == '3')
		{
			
			$output .= 'Traditional';
				
		}
		else if ($r == '4')
		{
			
			$output .= 'Others';
		
			
		}
		else
		{
		
			
			$output .= 'NIL';
		}

	return $output;

}
//end of show religion











//function select nationality
function select_nationality($n)
{
		
		if ($n == 'Nigerian')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="Nigerian" selected > Nigerian</option>';
			$output .= '<option value="Others" > NON Nigerian</option>';
		
			
		}
		else if ($n == 'Others')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="Nigerian" > Nigerian</option>';
			$output .= '<option value="Others"  selected>  NON Nigerian</option>';
		
			
		}
		else
		{
		
			$output = '<option value="0"  selected > -- Please Select --</option>';
			$output .= '<option value="Nigerian"> Nigerian</option>';
			$output .= '<option value="Others" > Others</option>';
		}

	return $output;

}

function show_nationality($n)
{
		
		if ($n == 'Nigerian')
		{
			$output = 'Nigerian';
		
		
			
		}
		else if ($n == 'Others')
		{
			$output = 'NON Nigerian';
		
			
		}
		else
		{
		
			$output = 'NIL';
		}

	return $output;

}



//function select sponsorship type
function select_sponsorship_type($r)
{
		
		if ($r == '1')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" selected > Private</option>';
			$output .= '<option value="2" > Self</option>';
			$output .= '<option value="3" > Governmental</option>';
			$output .= '<option value="4" > UNICEF</option>';
			$output .= '<option value="5" > Sport</option>';
		
			
		}
		else if ($r == '2')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" > Private</option>';
			$output .= '<option value="2" selected  > Self</option>';
			$output .= '<option value="3" > Governmental</option>';
			$output .= '<option value="4" > UNICEF</option>';
			$output .= '<option value="5" > Sport </option>';
		
		
			
		}
		else if ($r == '3')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" > Private</option>';
			$output .= '<option value="2"  > Self</option>';
			$output .= '<option value="3" selected  > Governmental</option>';
			$output .= '<option value="4" > UNICEF </option>';
			$output .= '<option value="5" > Sport </option>';
		
			
		}
		else if ($r == '4')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" > Private</option>';
			$output .= '<option value="2" > Self</option>';
			$output .= '<option value="3" > Governmental</option>';
			$output .= '<option value="4" selected > UNICEF </option>';
			$output .= '<option value="5" > Sport </option>';
		
		
			
		}
		else if ($r == '5')
		{
			$output = '<option value="0"  > -- Please Select --</option>';
			$output .= '<option value="1" > Private</option>';
			$output .= '<option value="2" > Self</option>';
			$output .= '<option value="3" > Governmental</option>';
			$output .= '<option value="4" > UNICEF </option>';
			$output .= '<option value="5" selected > Sport </option>';
		
		
			
		}
		else
		{
		
			$output = '<option value="0" selected  > -- Please Select --</option>';
			$output .= '<option value="1"  > Private</option>';
			$output .= '<option value="2" > Self</option>';
			$output .= '<option value="3"> Governmental </option>';
			$output .= '<option value="4"  > UNICEF </option>';
			$output .= '<option value="5"  > Sport </option>';

		}

	return $output;

}
//end of select sponsorship type

//function show sponsorship type
function show_sponsorship_type($r)
{
		
		if ($r == '1')
		{
		
			$output = 'Private';
			
		
			
		}
		else if ($r == '2')
		{
			
			$output = 'Self';
		
			
		}
		else if ($r == '3')
		{
			$output = 'overnmental';
		
		
			
		}
		else if ($r == '4')
		{
			$output = 'UNICEF';
		
			
		}
		else if ($r == '5')
		{
			$output = 'Sport';
		
		
			
		}
		else
		{
		
			$output = 'Nil';
		}

	return $output;

}
//end of show sponsorship type
	
	


//function select programme_type
function select_programme_type($pt)
{
		
		if ($pt == '1')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1" selected > PRE - NCE</option>';
			$output .= '<option value="2" > NCE </option>';
			$output .= '<option value="3" > DEGREE </option>';
			
		
			
		}
		else if ($pt == '2')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1"> PRE-NCE</option>';
			$output .= '<option value="2" selected > NCE </option>';
			$output .= '<option value="3" > DEGREE </option>';
			
		
			
		}
		else if ($pt == '3')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option value="1"> PRE-NCE</option>';
			$output .= '<option value="2"> NCE </option>';
			$output .= '<option value="3" selected  > DEGREE </option>';
			
		
			
		}
		else
		{
		
			$output = '<option value="0"  selected > -- Please Select --</option>';
			$output .= '<option value="1"> PRE-NCE</option>';
			$output .= '<option value="2" > NCE </option>';
			$output .= '<option value="3" > DEGREE </option>';
		
		}

	return $output;

}
//end of select programme_type


//function select entry_mode
function select_entry_mode($sm)
{
		
		if ($sm == '1')
		{
			$output  = 	'<option value="0"> -- Please Select  --</option>';
			$output .= 	'<option value="1" selected >PRE-NCE</option>';
			$output .= '<option value="2"  >NCE</option>';
			$output .= '<option value="3"  >Others</option>';
			
		
			
		}
		else if ($sm == '2')
		{
			$output  = '<option value="0"> -- Please Select  --</option>';
			$output .= '<option value="1"  >PRE-NCE</option>';
			$output .= '<option value="2" selected >NCE</option>';
			$output .= '<option value="3"  >Others</option>';
			
		
			
		}
		else if ($sm == '3')
		{
		
			$output  = '<option value="0"> -- Please Select  --</option>';
			$output .= '<option value="1"  >PRE-NCE</option>';
			$output .= '<option value="2">NCE</option>';
			$output .= '<option value="3" selected >Others</option>';
		
		}
		else 
		{
		
			$output  = '<option value="0"  selected > -- Please Select  --</option>';
			$output .= '<option value="1"  >PRE-NCE</option>';
			$output .= '<option value="2">NCE</option>';
			$output .= '<option value="3" >Others</option>';
		
		}

	return $output;

}
//end of select entry_mode



//function show entry_mode
function show_entry_mode($sm)
{
		
		if ($sm == '1')
		{
			$output  = 	'PRE-NCE';
			
		}
		else if ($sm == '2')
		{
			$output  = 'NCE-DIRECT';
			
		}
		else if ($sm == '3')
		{
		
			$output  = 'Others';
		
		}
		else 
		{
		
			$output = ' NIL';
		}

	return $output;

}
//end of show entry_mode


//function select award_in_view
function select_award_in_view($aiv)
{
		
		if ($aiv == '1')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .= '<option value="1"  selected  >NCE</option>';
			$output .= '<option value="2"  > N.D </option>';
			
		
			
		}
		else if ($aiv == '2')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .= '<option value="1"    >NCE</option>';
			$output .= '<option value="2" selected >N.D</option>';
			
		
		}
		
		else
		{
			$output = 	'<option value="0"  selected> -- Please Select-- </option>';
			$output .= '<option value="1" >NCE</option>';
			$output .= '<option value="2" >N.D</option>';
			
			
		}
	return $output;

}
//end of select award in view


//function show award_in_view
function show_award_in_view($aiv)
{
		
		if ($aiv == '1')
		{
			$output = 	'NCE';
	
		}
		else if ($aiv == '2')
		{
			$output = 	'N.D';
		
		}
		else
		{
			$output = 	'NIL';
			
		}
	return $output;

}
//end of show award in view



//function select highest qualification
function select_highest_qualification($hiq)
{
		
		if ($hiq == '1')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'  selected  >Bachelor's Degree</option>";
			$output .= '<option value="2"  >HND</option>';
			$output .= '<option value="3"  >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6"  >NDA</option>';
			$output .= '<option value="7"  >OND/HND</option>';
			$output .= '<option value="8"  >Others</option>';
			$output .= '<option value="9"  >PGD</option>';
			$output .= '<option value="10"  >PH.d</option>';
			$output .= '<option value="11"  >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12"  >TCI / ACE</option>';
			$output .= '<option value="13"  >WASC /GCE OL</option>';
			
			
		
			
		}
		else if ($hiq == '2')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >Bachelor's Degree</option>";
			$output .= '<option value="2" selected >HND</option>';
			$output .= '<option value="3"  >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6"  >NDA</option>';
			$output .= '<option value="7"  >OND/HND</option>';
			$output .= '<option value="8"  >Others</option>';
			$output .= '<option value="9"  >PGD</option>';
			$output .= '<option value="10"  >PH.d</option>';
			$output .= '<option value="11"  >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12"  >TCI / ACE</option>';
			$output .= '<option value="13"  >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '3')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" selected >HSG / GCE AL</option>';
			$output .= '<option value="4" >Masters</option>';
			$output .= '<option value="5" >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7" >OND/HND</option>';
			$output .= '<option value="8" >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '4')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4" selected >Masters</option>';
			$output .= '<option value="5" >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7" >OND/HND</option>';
			$output .= '<option value="8" >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '5')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5" selected >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7" >OND/HND</option>';
			$output .= '<option value="8" >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '6')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" selected >NDA</option>';
			$output .= '<option value="7" >OND/HND</option>';
			$output .= '<option value="8" >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '7')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7" selected >OND/HND</option>';
			$output .= '<option value="8" >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '8')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8"   selected >Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '9')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9"  selected >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '10')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10"  selected  >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '11')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11"   selected >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '12')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12" selected>TCI / ACE</option>';
			$output .= '<option value="13" >WASC /GCE OL</option>';
			
		}
		else if ($hiq == '13')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13"  selected>WASC /GCE OL</option>';
			
		}
		else
		{
			$output = 	'<option value="0"   selected> -- Please Select-- </option>';
			$output .=  "<option value='1'>Bachelor's Degree</option>";
			$output .= '<option value="2" >HND</option>';
			$output .= '<option value="3" >HSG / GCE AL</option>';
			$output .= '<option value="4"  >Masters</option>';
			$output .= '<option value="5"  >NCE</option>';
			$output .= '<option value="6" >NDA</option>';
			$output .= '<option value="7">OND/HND</option>';
			$output .= '<option value="8">Others</option>';
			$output .= '<option value="9" >PGD</option>';
			$output .= '<option value="10" >PH.d</option>';
			$output .= '<option value="11" >SSCE (WAEC/NECO/NABTEB)</option>';
			$output .= '<option value="12">TCI / ACE</option>';
			$output .= '<option value="13">WASC /GCE OL</option>';
		
			
		}
	return $output;

}
//end of select highest

//function show  highest qualification
function show_highest_qualification($hiq)
{
		
		if ($hiq == '1')
		{
			$output = 	"Bachelor's Degree";
			
			
		}
		else if ($hiq == '2')
		{
			$output = 	'HND';
			
		}
		else if ($hiq == '3')
		{
			$output = 	'HSG / GCE AL';
			
		}
		else if ($hiq == '4')
		{
			$output = 	'Masters';
			
		}
		else if ($hiq == '5')
		{
			$output = 	'NCE';
			
		}
		else if ($hiq == '6')
		{
			$output = 	'NDA';
			
		}
		else if ($hiq == '7')
		{
			$output = 	'OND/HND';
			
		}
		else if ($hiq == '8')
		{
			$output = 	'Others';
			
		}
		else if ($hiq == '9')
		{
			$output = 	'PGD';
			
		}
		else if ($hiq == '10')
		{
			$output = 	'PH.d';
			
		}
		else if ($hiq == '11')
		{
			$output = 	'SSCE (WAEC/NECO/NABTEB)';
			
		}
		else if ($hiq == '12')
		{
			$output = 	'TCI / ACE';
			
		}
		else if ($hiq == '13')
		{
			$output = 	'WASC /GCE OL';
			
		}
		else
		{
			$output = 	'NIL';
		
			
		}
	return $output;

}
//end of show highest qualification



//function select H status
function select_h_status($n)
{
		
		if ($n == 'Normal')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Normal" selected >Normal</option>';
			$output .= '<option value="Handicapped" >Handicapped</option>';
			$output .= '<option value="Others" >Others</option>';
			
			
		}
		else if ($n == 'Handicapped')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Normal" >Normal</option>';
			$output .= '<option value="Handicapped" selected >Handicapped</option>';
			$output .= '<option value="Others" >Others</option>';
			
			
		}
		else if ($n == 'Others')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Normal" >Normal</option>';
			$output .= '<option value="Handicapped" >Handicapped</option>';
			$output .= '<option value="Others" selected >Others</option>';
			
			
		}
		else 
		{
			$output = '<option value="0" selected > -- Please Select --</option>';
			$output .= '<option value="Normal" >Normal</option>';
			$output .= '<option value="Handicapped" >Handicapped</option>';
			$output .= '<option value="Others" >Others</option>';
			
			
		}

	return $output;

}


//function select disability
function select_disability($n)
{
		
		if ($n == 'Blind')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind" selected> Blind</option>';
			$output .= '<option value="Deaf">  Deaf</option>';
			$output .= '<option value="Dumb">  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None"> None</option>';
			$output .= '<option value="Others"> Others</option>';
			
		}
		else if ($n == 'Deaf' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  selected>  Deaf</option>';
			$output .= '<option value="Dumb">  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None"> None</option>';
			$output .= '<option value="Others"> Others</option>';
			
		}
		else if ($n == 'Dumb' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  >  Deaf</option>';
			$output .= '<option value="Dumb" selected>  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None"> None</option>';
			$output .= '<option value="Others"> Others</option>';
			
		}
		else if ($n == 'Handicapped' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  >  Deaf</option>';
			$output .= '<option value="Dumb" >  Dumb</option>';
			$output .= '<option value="Handicapped" selected>  Handicapped</option>';
			$output .= '<option value="None"> None</option>';
			$output .= '<option value="Others"> Others</option>';
			
		}
		else if ($n == 'None' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  >  Deaf</option>';
			$output .= '<option value="Dumb" >  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None"  selected> None</option>';
			$output .= '<option value="Others"> Others</option>';
			
		}
		else if ($n == 'Others' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  >  Deaf</option>';
			$output .= '<option value="Dumb" >  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None" > None</option>';
			$output .= '<option value="Others"  selected> Others</option>';
			
		}
		else
		{
			$output = '<option value="0"  selected> -- Please Select --</option>';
			$output .= '<option value="Blind"> Blind</option>';
			$output .= '<option value="Deaf"  >  Deaf</option>';
			$output .= '<option value="Dumb" >  Dumb</option>';
			$output .= '<option value="Handicapped">  Handicapped</option>';
			$output .= '<option value="None" > None</option>';
			$output .= '<option value="Others" > Others</option>';
		}

	return $output;

}


//function select bg
function select_bg($n)
{
		
		if ($n == 'AB')
		{
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="AB" selected> AB</option>';
			$output .= '<option value="O">  O </option>';
			$output .= '<option value="A+"> A+</option>';
			$output .= '<option value="B+"> B+</option>';
			
			
		}
		else if ($n == 'O' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="AB" > AB</option>';
			$output .= '<option value="O" selected>  O </option>';
			$output .= '<option value="A+"> A+</option>';
			$output .= '<option value="B+"> B+</option>';
			
		}
		else if ($n == 'A+' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="AB" > AB</option>';
			$output .= '<option value="O" >  O </option>';
			$output .= '<option value="A+" selected> A+</option>';
			$output .= '<option value="B+"> B+</option>';
			
		}
		else if ($n == 'B+' )
		{
		
			$output = '<option value="0"> -- Please Select --</option>';
			$output .= '<option value="AB" > AB</option>';
			$output .= '<option value="O" >  O </option>';
			$output .= '<option value="A+" > A+</option>';
			$output .= '<option value="B+" selected> B+</option>';
			
		}
		else
		{
			$output = '<option value="0"  selected> -- Please Select --</option>';
			$output .= '<option value="AB" > AB</option>';
			$output .= '<option value="O" >  O </option>';
			$output .= '<option value="A+" > A+</option>';
			$output .= '<option value="B+"> B+</option>';
		}

	return $output;

}
//end of blood group selection

//function select exam _type 
function select_exam_type($st)
{
		
		
		if ($st == 'GRADE II TEACHERS CERT.')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option  selected > GRADE II TEACHERS CERT.</option>';
			$output .= '<option > NABTEB</option>';
			$output .= '<option  >NECO</option>';
			$output .= '<option  >WAEC</option>';
		
			
		}
		else if ($st == 'NABTEB')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option > GRADE II TEACHERS CERT.</option>';
			$output .= '<option  selected  > NABTEB</option>';
			$output .= '<option  >NECO</option>';
			$output .= '<option  >WAEC</option>';
		
			
		}
		else if ($st == 'NECO')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option > GRADE II TEACHERS CERT.</option>';
			$output .= '<option > NABTEB</option>';
			$output .= '<option selected >NECO</option>';
			$output .= '<option  >WAEC</option>';
		
			
		}
		else if ($st == 'WAEC')
		{
			$output = '<option value="0" > -- Please Select --</option>';
			$output .= '<option > GRADE II TEACHERS CERT.</option>';
			$output .= '<option > NABTEB</option>';
			$output .= '<option>NECO</option>';
			$output .= '<option  selected>WAEC</option>';
		
			
		}
		else
		{
		
			$output = '<option value="0" selected > -- Please Select --</option>';
			$output .= '<option > GRADE II TEACHERS CERT.</option>';
			$output .= '<option > NABTEB</option>';
			$output .= '<option>NECO</option>';
			$output .= '<option  >WAEC</option>';
		
		}

	return $output;

}
//end of select exam type



//function select subjects
function select_subjects($c)
{
	$r = mysql_query("SELECT id, title  FROM o_level_subjects  ORDER BY title ");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($c == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select subjects


//function select exam month
function select_exam_month($hiq)
{
		
		if ($hiq == '1')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'  selected  >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5"  >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
		
			
		}
		else if ($hiq == '2')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  selected  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5"  >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '3')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  selected  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5"  >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '4')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4" selected >JUNE</option>';
			$output .= '<option value="5"  >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '5')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5" selected >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '6')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5"  >JULY</option>';
			$output .= '<option value="6" selected >OCTOBER</option>';
			$output .= '<option value="7"  >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '7')
		{
		    $output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5" >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7"  selected >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
			
		}
		else if ($hiq == '8')
		{
			 $output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5" >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7" >NOVEMBER</option>';
			$output .= '<option value="8"  selected  >DECEMBER</option>';
			
		}
		else
		{
			$output = 	'<option value="0"  selected > -- Please Select-- </option>';
			$output .=  "<option value='1' >JUN/JUL</option>";
			$output .= '<option value="2"  >OCT/NOV</option>';
			$output .= '<option value="3"  >NOV/DEC</option>';
			$output .= '<option value="4"  >JUNE</option>';
			$output .= '<option value="5" >JULY</option>';
			$output .= '<option value="6"  >OCTOBER</option>';
			$output .= '<option value="7" >NOVEMBER</option>';
			$output .= '<option value="8"  >DECEMBER</option>';
		
			
		}
	return $output;

}
//end of select exam month



//function select highest qualification
function select_subject_grade($hiq)
{
		
		if ($hiq == '1')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'  selected  >A1</option>";
			$output .= '<option value="2"  >B2</option>';
			$output .= '<option value="3"  >B3</option>';
			$output .= '<option value="4"  >C4</option>';
			$output .= '<option value="5"  >C5</option>';
			$output .= '<option value="6"  >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9" >F9</option>';
			$output .= '<option value="10" >AR</option>';
	
			
			

		
			
		}
		else if ($hiq == '2')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >A1</option>";
			$output .= '<option value="2"   selected  >B2</option>';
			$output .= '<option value="3"  >B3</option>';
			$output .= '<option value="4"  >C4</option>';
			$output .= '<option value="5"  >C5</option>';
			$output .= '<option value="6"  >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '3')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >A1</option>";
			$output .= '<option value="2"  >B2</option>';
			$output .= '<option value="3" selected >B3</option>';
			$output .= '<option value="4"  >C4</option>';
			$output .= '<option value="5"  >C5</option>';
			$output .= '<option value="6"  >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '4')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1' >A1</option>";
			$output .= '<option value="2"  >B2</option>';
			$output .= '<option value="3"  >B3</option>';
			$output .= '<option value="4" selected >C4</option>';
			$output .= '<option value="5"  >C5</option>';
			$output .= '<option value="6"  >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '5')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5"  selected >C5</option>';
			$output .= '<option value="6"  >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '6')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" selected >C6</option>';
			$output .= '<option value="7"  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '7')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" >C6</option>';
			$output .= '<option value="7"  selected  >D7</option>';
			$output .= '<option value="8"  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '8')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" >C6</option>';
			$output .= '<option value="7" >D7</option>';
			$output .= '<option value="8" selected  >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '9')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" >C6</option>';
			$output .= '<option value="7" >D7</option>';
			$output .= '<option value="8" >E8</option>';
			$output .= '<option value="9"  selected  >F9</option>';
			$output .= '<option value="10" >AR</option>';
			
		}
		else if ($hiq == '10')
		{
			$output = 	'<option value="0"> -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" >C6</option>';
			$output .= '<option value="7" >D7</option>';
			$output .= '<option value="8" >E8</option>';
			$output .= '<option value="9"  >F9</option>';
			$output .= '<option value="10"  selected >AR</option>';
			
		}
		else
		{
			$output = '<option value="0"  selected  > -- Please Select-- </option>';
			$output .=  "<option value='1'>A1</option>";
			$output .= '<option value="2" >B2</option>';
			$output .= '<option value="3" >B3</option>';
			$output .= '<option value="4" >C4</option>';
			$output .= '<option value="5" >C5</option>';
			$output .= '<option value="6" >C6</option>';
			$output .= '<option value="7" >D7</option>';
			$output .= '<option value="8" >E8</option>';
			$output .= '<option value="9" >F9</option>';
			$output .= '<option value="10" >AR</option>';
		
			
		}
	return $output;

}
//end of select exam grade





	
	
	
	//Function to fetch current session
	function get_current_session($id)
	{
		$result = mysql_query("SELECT * FROM sessions WHERE current_session = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$id = $row['id'];
		
	return $id;
	}
	
	
	//Function to fetch  session
	function get_session_title($id)
	{
		$result = mysql_query("SELECT * FROM sessions WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$title = $row['title'];
		
	return $title;
	}
	
	
	
	//Function to fetch current semester
	function get_current_semester($id)
	{
		$result = mysql_query("SELECT * FROM semesters WHERE current_session = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$id = $row['id'];
		
	return $id;
	}
	
	
	//Function to fetch  semester
	function get_semester_title($id)
	{
		$result = mysql_query("SELECT * FROM semesters WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$title = $row['title'];
		
	return $title;
	}
	
	
	
	

//function select country
function select_country($c)
{
	$r = mysql_query("SELECT id, country_name  FROM countries  ORDER BY country_name ");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($c == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['country_name'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['country_name'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select country_name




//function show country title
function show_country($c)
{
	$r = mysql_query("SELECT  country_name  FROM countries WHERE id = '$c'");
	$row = mysql_fetch_assoc($r);
		
    return $row['country_name'];
		
}
//end of show country_name






//function select state 
function select_state( $state)
{
	$r = mysql_query("SELECT id, title  FROM state  ORDER BY title ");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($state == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select state


//function show state
function show_state($c)
{
	$r = mysql_query("SELECT  title  FROM state WHERE id = '$c'");
	$row = mysql_fetch_assoc($r);
		
    return $row['title'];
		
}
//end of show state



function select_lga( $lga)
{
	$r = mysql_query("SELECT id, title  FROM lga  ORDER BY title ");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($lga == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select lga



//function show lga
function show_lga($c)
{
	$r = mysql_query("SELECT  title  FROM lga WHERE id = '$c'");
	$row = mysql_fetch_assoc($r);
		
    return $row['title'];
		
}
//end of show state


//select schools
function select_school($f)
{
	$r = mysql_query("SELECT id, title  FROM schools WHERE real_ != 1  ORDER BY title");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($f == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select school




//select department
function select_department($department)
{
	$r = mysql_query("SELECT id, title  FROM departments  ORDER BY title");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($department == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select department




//select programme
function select_programme($p)
{
	$r = mysql_query("SELECT id, title  FROM programmes  ORDER BY title");
	if(mysql_num_rows($r) > 0 )
	{
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			if($p == $row['id'])
			{
				$output = "<option value=\"$row[id]\" selected>";
				$output .=  $row['title'];
				$output .="</option>";
				
			}
			else
			{
				$output = "<option value=\"$row[id]\" >";
				$output .= $row['title'];
				$output .="</option>";
				
			}
			 
			
			echo $output;
		}
	}
	else
	{
		
			$output = "<option>";
			$output .="Not added yet";
			$output .="</option>"; 
			
			echo $output;
	}
}
//end of select programmes





//function calendar yer
function year($y)
{
	$y = $y;
	$years = range(1980, 2015);
	
	foreach ($years as $value) 
	{
		if($y == $value)
		{
	   		echo "<option value=\"$value\" selected>$value</option>\n";
		}
		else
		{
			echo "<option value=\"$value\">$value</option>\n";
		}
	}
	
	
}//end of year



//function calendar months
function month($m)
{
	$m = $m;
	$months = range(1, 12);
	
	foreach ($months as $value) 
	{
		if($m == $value)
		{
	   		echo "<option value=\"$value\" selected>$value</option>\n";
		}
		else
		{
			echo "<option value=\"$value\">$value</option>\n";
		}
	}
	
	
}




//function calendardays
function day($d)
{
	$d = $d;
	$days = range(1, 31);
	
	foreach ($days as $value) 
	{
		if($d == $value)
		{
	   		echo "<option value=\"$value\" selected>$value</option>\n";
		}
		else
		{
			echo "<option value=\"$value\">$value</option>\n";
		}
	}
	
	
}


//get programme name
function get_programme_title($id)
{
	$result = mysql_query("SELECT title FROM programmes WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$title = $row['title'];

	return $title;
}

//get programme name
function get_programme_code($id)
{
	$result = mysql_query("SELECT code FROM programmes WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$title = $row['code'];

	return $title;
}
//

//get department name
function get_department_title($id)
{
	$result = mysql_query("SELECT title FROM departments WHERE id = '$id'"); 
	$row = mysql_fetch_assoc($result);
	$title = $row['title'];

	return $title;
}


//get department name
function get_school_title($id)
{
	$result = mysql_query("SELECT title FROM schools WHERE id = '$id'"); 
	$row = mysql_fetch_assoc($result);
	$title = $row['title'];

	return $title;
}



//get departmet id base on user id

//function that gets  school id base on user id
function  get_school_id($user_id)
{	
	$result = mysql_query("SELECT school_id FROM students_nce WHERE id = '$user_id'"); 
		$row = mysql_fetch_assoc($result);
		$v = $row['school_id'];

	return $v;
	
}






//function that gets programme duration
function  get_programme_duration($id)
{	
	$result = mysql_query("SELECT duration FROM programmes WHERE id = '$id'"); 
		$row = mysql_fetch_assoc($result);
		$v = $row['duration'];

	return $v;
	
}

////##############################################################################################
//id card functions starts here


//get list of the programmes 
function  get_programme_list($pt,$lvl,$ky)
{	
	$result = mysql_query("SELECT * FROM programmes WHERE type_id = '$pt' AND real_ = 0"); 
		
		
	//if(mysql_num_rows($result>0))
//	{	
		while($row = mysql_fetch_array($result, MYSQL_ASSOC))
		{
			echo '<a href="index_students_nce.php?a='.sha1('fucku').'&ky='.$ky.'&pt='.$row['type_id'].'&p='.$row['id'].'&lvl='.$lvl.'" class="btn btn-info  btn-lg" target="_blank" style="margin:4px;" >'.$row['title'].' - <span class="badge">'.get_total_prog_type_programme_students_nce($pt,$row['id'],$lvl).'</span>'.'</a> <br/>';
		}
		
	//}
//	else
//	{
//		echo "No data found..";
//	}
		
}
	
	
	
	//get list of the programmes 
function  get_programme_list_prence($pt)
{	
	$result = mysql_query("SELECT * FROM programmes WHERE type_id = '$pt'"); 
		
		
	//if(mysql_num_rows($result>0))
//	{	
		while($row = mysql_fetch_array($result, MYSQL_ASSOC))
		{
			echo '<a href="index_students_prence.php?a='.sha1('fucku').'&pt='.$row['type_id'].'&p='.$row['id'].'" class="btn btn-info  btn-lg" target="_blank" style="margin:4px;" >'.$row['title'].' - <span class="badge">'.get_total_prog_type_programme_students_prence($pt,$row['id']).'</span>'.'</a> <br/>';
		}
		
	//}
//	else
//	{
//		echo "No data found..";
//	}
		
}
	
//function get total applicants in a programme 
function get_total_prog_type_programme_applicants($pt, $id)
{
	$q = "SELECT COUNT(id) FROM applicants_nce  WHERE programme_type_applied_for = '$pt' AND programme_id = '$id'";
	$r = mysql_query($q);
	$row = mysql_fetch_array($r,MYSQL_NUM);
	
	return $row[0];
	
}


//function get total students in a programme 
function get_total_prog_type_programme_students_nce($pt, $id,$lvl)
{
	$q = "SELECT COUNT(id) FROM students_nce  WHERE type_id = '$pt' AND programme_id = '$id' AND level = '$lvl'";
	$r = mysql_query($q);
	$row = mysql_fetch_array($r,MYSQL_NUM);
	
	return $row[0];
	
}
	
	

//function view applicants listings per programmes
function view_students_list_per_programmes($pt,$p,$lvl,$tk) // pt programm type , p programme //AND applicants.id = applicants_fee_payments.applicant_id
{
	//please remove applicant later
	
	//query the database
	$q = "SELECT id, type_id, school_id,department_id, programme_id, application_number, number,
		  state_id, lga_id, first_name, other_names, phone_no, gender,  email, level,  
		  DATE_FORMAT(date_added, '%M %d, %Y %l:%i:%p') as date_added
		  FROM  students_nce 
		 
		  WHERE   type_id = '$pt' AND programme_id = '$p'  AND level = '$lvl'
		 
		  ORDER BY number ASC";
	$r = mysql_query($q);
	
	if(mysql_num_rows($r) > 0)
	{//show table
	
	
		
		  $output = 
		  '<table id="example" class="user display table-bordered table-hover table-striped" cellspacing="0" width="100%" style="font-size:12px;">
			<thead>
						<th>Application No.</th>
						<th>Matric No.</th>

						<th>Name</th>
						<th>Gender</th>
						<th>Programme Type</th>
						<th>School </th>
						<th>Programme</th>
						<th>Level</th>
						
						<th>Ph. Contacts</th>
						<th>State</th>
						<th>L.G.A</th>
						<th>Passports</th>
						
						
						
			</thead>
			<tfoot>
						
						<th>Application No.</th>
						<th>Matric No.</th>
						<th>Name</th>
						<th>Gender</th>
						<th>Programme Type</th>
						<th>School </th>

						<th>Programme</th>
						<th>Level</th>
						<th>Ph. Contacts</th>
						<th>State</th>
						<th>L.G.A</th>
						<th>Passports</th>
						
			</tfoot>
			
			<tbody>';
	
		while($row = mysql_fetch_array($r, MYSQL_ASSOC))
		{
			$output .= "<tr>";
			$output .= "<td>".$row['application_number']."</td>";
			$output .= "<td>".$row['number']."</td>";


			$output .= "<td> <a href='print_card.php?icant_profile&id=".md5('profile')."&yId=".$row['id']."&ky=".$tk."' target='_new'>".$row['first_name'].' '.$row['other_names']."</a></td>";
			$output .= "<td>".$row['gender']."</td>";
			$output .= "<td>".show_programme_type($row['type_id'])."</td>";
			$output .= "<td>".get_school_title($row['school_id'])."</td>"; 

			$output .= "<td>".get_programme_title($row['programme_id'])."</td>"; 
			$output .= "<td>".$row['level']."</td>"; 
			$output .= "<td>".$row['phone_no']."</td>"; 
			$output .= "<td>".show_state($row['state_id'])."</td>";
			$output .= "<td>".show_lga($row['lga_id'])."</td>";
			$output .= "<td><img src='../nce/uploads/".get_user_image($row['id'])."' width='97' height='117'/></td>";
			
			
			
			$output .= "</tr>";
			
			
		}
	}
	else
	{//show the msg 
	
			$output = 
				   '<div class="alert alert-danger alert-dismissable"> 
					<button class="close" aria-hidden="true" data-dismiss="alert" type="button">x</button>
					<img src="images/info.png" />&nbsp;&nbsp; No record found in the system.
				   </div>';
		
		
	}
	
	
	
	$output .=
	'</tbody>
    </table>';
	
	
	
	
	
	return $output;
	
	
	
	
}//end of view applicants listings per programmes

	
//function show programme_type
function show_programme_type($pt)
{
		
		if ($pt == '1')
		{
			$output = 'PRE-NCE';
			
		}
		else if ($pt == '2')
		{
			$output = 'NCE';
		
		}
		else if ($pt == '3')
		{
			$output = 'DEGREE';
		
		}
		else
		{
		
			$output = 'NIL';
		
		}

	return $output;

}
//end of show programme_type




//function get student image by passing id alone
function get_student_image($id)
{
	$result = mysql_query("SELECT image FROM students_nce WHERE id = '$id'"); 
	$row = mysql_fetch_assoc($result);
	$image = $row['image'];

	
	
	
	if($image != '')
	{//show table
	
		
		
			$output = '<img class="img-responsive img-rounded img-thumbnail center-block" src="#" style="height:100px ;width:80px"    />'; //https://eportals.ibbuconsult.com.ng/ndp/uploads/'.$row['image'].'
			
	
	}
	else
	{
		$output = '<label class="label label-danger">NO IMAGE</label>'; 
	}
	
	
	return $output;
	
	
	
	
}//end of function that shows candidate image

//for encoding url
function base64url_encode($str) {
    return strtr(base64_encode($str), '+/', '-_');
}
//for decoding url
function base64url_decode($base64url) {
    return base64_decode(strtr($base64url, '-_', '+/'));
}
function url_token() {
	$tk = 'COE@001-students_idcards';
    return $tk;
}
function hash_token($tk) {
	
    return md5($tk);
}

?>