		
	///get student information	

$chkprofile=mysqli_query(dbc(),"SELECT *FROM applicants WHERE id='$user_login_id'") or die(mysql_error());
if($chkprofile){
	$chkprofile_row=mysqli_num_rows($chkprofile);
	if($chkprofile_row > 0){
		$record=mysqli_fetch_array($chkprofile);
		$id=$record['id']; 
		$firstname=$record['first_name']; 
		$othernames=$record['other_names'];
		$fullname=$firstname." ".$othernames;
		$maritalstatus=$record['maritalstatus'];
		$matric=$record['number'];
		$level=$record['level'];
		$dept=$record['department_id'];
		$program=$record['programme_id'];
		$faculty_id=$record['faculty_id'];
		$gender=$record['gender'];
		$day=$record['day'];
		$month=$record['month'];
		$year=$record['year'];
		$phone_no=$record['phone_no'];
		$nitionality=$record['nitionality'];
		$state=$record['state'];
		$lga=$record['lga'];
		$email=$record['email'];
		$address=$record['address'];
		$image=$record['image'];
		$medi=$record['medi'];
		$H_status=$record['H_status'];
		$application_status=$record['application_status'];
		$mode_of_entry=$record['mode_of_entry'];
		$olevelrtype=$record['olevelrtype'];
		$disability=$record['disability'];
		$blood_type=$record['blood_type'];
		$jambscore=$record['jambscore'];
		$reg_no=$record['reg_no'];
		
		if(empty($image)){
			$image='<a href="#" class="btn btn-success btn-sm" data-toggle="modal" data-target="#myModal"><img width="150px" height="150px" src="uploads/0/img.jpg" alt="user" class="img-thumbnail"></a>';
			
		}else{
			$image='<a href="#" class="btn btn-success btn-sm" data-toggle="modal" data-target="#myModal"><img width="150px" height="150px" src="uploads/'.$image.'" alt="user" class="img-thumbnail"></a>';
		}
	}

}	
		//get programme (when needed)
		$getdepttitle=mysqli_query(dbc(),"SELECT *FROM departments WHERE id='$dept'") or die(mysql_error());
		if($getdepttitle){
			$getdepttitlerow=mysqli_num_rows($getdepttitle);
			if($getdepttitlerow){
				$getDpt=mysqli_fetch_array($getdepttitle);
				$dpt=$getDpt['title'];
			}
	}



	if($olevelrtype="ONE RESULT"){
		//get amount to be paid
		$sqlGetPayment=mysqli_query(dbc(),"SELECT *FROM set_payment WHERE id=5");
		if($sqlGetPayment){
			$sqlGetPaymentrow=mysqli_num_rows($sqlGetPayment);
			if($sqlGetPaymentrow > 0){
				$p=mysqli_fetch_array($sqlGetPayment);
				$amount=$p['amount'];
				$type=$p['title'];
			}
		}
		
		//if update olevel is click
		
	}elseif($olevelrtype="TWO RESULT"){
		//get amount to be paid
		$sqlGetPayment=mysqli_query(dbc(),"SELECT *FROM set_payment WHERE id=6");
		if($sqlGetPayment){
			$sqlGetPaymentrow=mysqli_num_rows($sqlGetPayment);
			if($sqlGetPaymentrow > 0){
				$p=mysqli_fetch_array($sqlGetPayment);
				$amount=$p['amount'];
				$type=$p['title'];
			}
		}
		
		//if update olevel is click
		
	}
	
	//get payment status for pre admition process
		$sqlGetPaymentStatus=mysqli_query(dbc(),"SELECT *FROM school_fee_payment WHERE student_id='$user_login_id' AND payment_type='$type' AND payment_status='1'");
		if($sqlGetPaymentStatus){
			$sqlGetPaymentStatusrow=mysqli_num_rows($sqlGetPaymentStatus);
			if($sqlGetPaymentStatusrow > 0){
				$status="PAID";
				$form='<a href="#">Print Payment Slip</a>';
			}else{
				$status="NOT PAID";
				$pf_qlk=md5(1);
				$form='<form name="frmpay" action="dashboard.php?qlk='.$pf_qlk.'" method="POST">
					<input value="Pay Now" name="payfee" type="submit" class="btn btn-sm btn-primary />';
					
					
			}
		}
		
		//pay fee
		if(isset($_POST['payfee'])){
			$sqlPay_std_pre_fee=mysqli_query(dbc(),"INSERT INTO school_fee_payment(student_id,payment_year,session,payment_type,amount,payment_status,date_added)VALUES('$user_login_id','2015','2015/2016','$type','$amount','1',now())");
		}
		

//pay bill (temp)
if(isset($_POST['btnPay'])){
	$updatePayment=mysqli_query(dbc(),"UPDATE school_fee_payment SET payment_status='1' WHERE student_id='$user_login_id'") or die(mysql_error());
	
}



///generate transaction
if(isset($_POST['btnGenerate'])){
	//pay fee
	$fee_type=$_POST['feetype'];
	//get the amount for payment
	$sqlAmount=mysqli_query(dbc(),"SELECT *FROM set_payment WHERE title='$fee_type'") or die(mysql_error());
		if($sqlAmount){
			$sqlAmountrow=mysqli_num_rows($sqlAmount);
			if($sqlAmountrow > 0){
				$get=mysqli_fetch_array($sqlAmount);
					$amount=$get['amount'];
			}
		}
	
	$sqlPay_std_fee=mysqli_query(dbc(),"INSERT INTO school_fee_payment(student_id,payment_year,session,payment_type,amount,payment_status,date_added)VALUES('$user_login_id','2015','2015/2016','$fee_type','$amount','0',now())");
		
}

//delete student course from reg
	if(isset($_GET['act']) && isset($_GET['qlk']) && isset($_GET['cr_qlk_epd'])){
		$token_id=$_GET['act'];
		$sqlDeleteCourse=mysqli_query(dbc(),"DELETE FROM ug_students_courses WHERE course_id='$token_id'");
		//$sqlDeleteCourse=mysqli_query(dbc(),"UPDATE ug_students_courses SET add_drop_status=2 WHERE course_id='$token_id'");
	}
//get the current session 
$session_id="3";


//hostel application
if(isset($_POST['btnHostelApply'])){
		
			$sqlApplyHostel=mysqli_query(dbc(),"INSERT INTO hostel_applicants(student_reg_id,date_added) VALUES('$user_login_id',now())");
	if($sqlApplyHostel){
	$hoel_appplication_error=
	'<div class="alert alert-danger">
			 			<button class="close" data-dismiss="alert" type="button">
			 				X
    		 			</button>
						<p>Your application has been submited, we will review your application and get back to you soon</p>
						
						<br/><br/>
						
                    </div>';
		
	}

}
	//chk if the application is sent befor or not
	$sqlchk=mysqli_query(dbc(),"SELECT *FROM hostel_applicants WHERE student_reg_id='$user_login_id'");
	if($sqlchk){
		$sqlchkrow=mysqli_num_rows($sqlchk);
		if($sqlchkrow > 0){
				$hoel_appplication_error=
	'<div class="alert alert-danger">
			 			<button class="close" data-dismiss="alert" type="button">
			 				X
    		 			</button>
						<p>We have received your application and now reviewing it, we will get back to you soon</p>
						
						<br/><br/>
						
                    </div>';
		}else{
		
		$hoel_appplication_error='
<img src="images/info.png" />TERM AND CONDITIONS
				<br/><br/><br/><br/><br/>
				<form name="frmHostel" action="dashboard.php?qlk=<?php echo$hps_qlk; ?>" method="POST">
						<input type="submit" class="btn btn-default" name="btnHostelApply" value="Apply for Hostel">
						</form>
				';

		}
	}
	
//end of hostel application script

//election application
if(isset($_POST['btnelectionapplication'])){
		
			$sqlApplyelection=mysqli_query(dbc(),"INSERT INTO election_intrest(student_id,date_added) VALUES('$user_login_id',now())");
	if($sqlApplyelection){
	$sqlApplyelection_error=
	'<div class="alert alert-danger">
			 			<button class="close" data-dismiss="alert" type="button">
			 				X
    		 			</button>
						<p>Your application has been submited, we will review your application and get back to you soon</p>
						
						<br/><br/>
						
                    </div>';
		
	}

}