<?php
$errmsg='';
$sucmsg='';
$applicant_idgdef = $_GET['i'];
$myID = $applicant_idgdef;


if(isset($_POST['update'])){
    extract($_POST);
	$errmsg='';
    $sucmsg='';
    
}

//GET DETAILS FROM DB

	$q = "Select * from prob_application where id=$applicant_idgdef limit 1";
    $qry=mysqli_query($con, $q);
    $row=mysqli_fetch_assoc($qry);
    extract($row);
	//print_r($row);
	$myAppID = $id;
    $applicant_no = $memberNo;

	switch($memberGrade)
	{
		case 1: $memberGrade="Fellow";
		break;
		
		case 2: $memberGrade="Member";
		break;
		
		case 3: $memberGrade="Probationer";
		break;
		
		case 4: $memberGrade="Technician";
		break;
		
		case 5: $memberGrade="Student";
		break;
		
		case 6: $memberGrade="Practicing Firm";
		break;
		
		case 7: $memberGrade="Graduate";
		break;
		
		case 8: $memberGrade="State Chapter";
		break;
		
		case 9: $memberGrade="Past President";
		break;
		
	}
	
?>



<div class="graph-visual tables-main" name='myarea' id='myarea'>
<?php
//header
echo "<table width='100%' cellspacing='0'>";
/*
echo "<tr><td><img src='images/logo.png'></td><th><h3><center>THE NIGERIAN INSTITUTE OF QUANTITY SURVEYORS <br>
 APPLICATION FOR TEST OF PROFESSIONAL COMPETENCE INTERVIEW <br>
(PCI-CANDIDATE)</center></h3></th></tr>";

echo "<tr><td colspan='3'><h4> PLEASE READ THE INSTRUCTIONS BELOW BEFORE COMPLETING THE FORM </h4></td></tr>";
echo "<tr><td colspan='3'> 
<ol>
<li> The Institute will neither entertain further correspondence in connection with the examination results released nor state reasons for any decision made with reference
to the examination.</li>

<li>Only financial members of the Institute will be allowed to sit or sponsor candidates for the examination.</li>
<li>Payment of the non-refundable examination fee must be made in full online before you can proceed with the application.</li>
<li>Print the duly completed application form after submission online and return to the Institute in an envelope addressed to the Secretary General, NIQS No 84, 4th
Avenue (Sa’adu Zungur Avenue) Gwarinpa, Abuja. This shall include photocopies of the following:</li>
  <ul>
	<li><font color='red'>Two 2 Recent Passport Sized Photographs</font></li>
	<li><font color='red'>O'Level Certificate (Not Statement of Result)</font></li>
	<li><font color='red'>Copy of Graduate Level Certificates (compulsory)/Postgraduate Certificates (where applicable) </font></li>
	<li><font color='red'>Membership Certificate of other professional bodies</font></li>
	<li><font color='red'>Evidences of Logbooks/Diaries Assessments stages 1,2,3, Passed</font></li>
	<li><font color='red'>GDE & TPC Examinations Results (passed)</font></li>
	<li><font color='red'>Copy of Logbook/Diary Stage 3 Report</font></li>
	<li><font color='red'>Evidence of confirmed online payment of the examination fee. (N20,000.00)</font></li>
   </ul>
<li><b>EXAMINATION COMMUNICATION OFFENCE:</b></li>
	<ol>
	  <li>Except in the case of examination fraud that is supported by documentary evidence, the Institute will not entertain any communication with examination candidates in respect of the outcome of examination results. Any such communication will attract suspension from future examinations.</li>
	  <li>At any point in time that any false information is detected in any documentation, it will lead to the cancellation of examination application, result and ultimately withdrawal of certificate.</li>
	</ol>
</ol>
 </td></tr>";
*/

//things to fix
/*
$memberDOB = "02-02-1976";
$memberRegDate = "02-02-2015";
$interviewCentre = "Abuja";
*/

echo "<tr><td><img src='images/logo.png' width='100px' height='150px'></td><th><h2><center>THE NIGERIAN INSTITUTE OF QUANTITY SURVEYORS </h2></center><center><h3>
 APPLICATION FOR GRADUATE EXAMINATION <br>
(GDE FULL CANDIDATE - $regSet)</center></h3>   </th> <td>"; 
		$mypassport = "passport/".$applicant_no."_".$applicant_idgdef.".jpg";
		$filemtime = filemtime($mypassport);
				
		 if(!empty($mypassport))
		 {   
			 echo "<img src='".$mypassport."?".$filemtime."' width='120px' height='150px'><font color='black'>GF".$uniqueId."</font> <br><br>";
		 }

echo "</td></tr>";

echo "</table>";
echo "<table width='100%' cellspacing='0'>";

//1.0
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>1.0 PERSONAL DETAILS</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td width='40%' height='30px'> &nbsp; <b> NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberNo)." </td></tr>";
	echo "<tr><td> &nbsp; <b> SURNAME: </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($memberSurname)." </td></tr>";
	echo "<tr><td> &nbsp; <b> OTHER NAMES: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberOthernames)." </td></tr>";
	echo "<tr><td> &nbsp; <b> TITLE/GENDER: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberTitle)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DATE OF BIRTH: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberDOB)." </td></tr>";
	echo "<tr><td> &nbsp; <b> CHAPTER: </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($memberChapter)." </td></tr>";
	echo "<tr><td> &nbsp; <b> PHONE NUMBER:  </b></td> 				<td colspan='2'> &nbsp;  $memberPhone1, $memberPhone2 </td></tr>";
	echo "<tr><td> &nbsp; <b> EMAIL ADDRESS: </b></td> 				<td colspan='2'> &nbsp;  ".$memberEmail." </td></tr>";
	echo "<tr><td> &nbsp; <b> POSTAL ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberAddress)." </td></tr>";
	echo "<tr><td> &nbsp; <b> CURRENT MEMBERSHIP GRADE: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberGrade)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DATE OF REGISTRATION: </b></td> 		<td colspan='2'> &nbsp;  ".strtoupper($memberRegDate)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DIET:  </b></td> 						<td colspan='2'> &nbsp;  ".strtoupper($regSet)." </td></tr>";
	echo "<tr><td> &nbsp; <b> DISABILITY:  </b></td> 					<td colspan='2'> &nbsp;  ".strtoupper($disability); if($disability=='YES'){ echo " - ".$disability_type; } echo "   </td></tr>";
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";
	
//2.0 centre
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> <b>2.0 PREFERRED INTERVIEW CENTRE:</b> </font></td></tr>";
echo "<tr><td colspan='3'> ".strtoupper($examCentre)." </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//3.0 olevel
/*
$q = "Select * from prob_olevel where applicant_id='$applicant_idgdef'";
$qry2=mysqli_query($con, $q);

echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> <b>3.0 O' LEVEL SUBJECTS RESULT (5 CREDITS FROM WAEC/NECO/NABTEB):</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='50%' border='1' cellspacing='0'>";
	echo "<tr bgcolor='skyblue'><td> &nbsp; <b> SUBJECTS </b></td> 	<td align='center'><b> GRADE </b></td></tr>";

	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td><b> &nbsp; ".$subject."</b></td> 	<td align='center'> ".strtoupper($grade)." </td></tr>";
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";
*/


//3.0 education
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>3.0 EDUCATION:</b> </font></td></tr>";

//3.1
$q = "Select * from prob_education where applicant_id='$applicant_idgdef' and eduCat='Secondary School'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='left'> &nbsp; <b> NAME OF INSTITUTION </b></td> 	<td align='center'><b> YEAR OF ENTRY </b></td> 	<td align='center'><b> YEAR OF LEAVING </b></td>  <td align='center'><b> CERTIFICATE/DIPLOMA/<br>DEGREE OBTAINED</b></td>  </center></b></td> </tr>";
	echo "<tr><td colspan='4'><font size='3'>   </font></td></tr>";
	echo "<tr><td colspan='4'><font color='black' size='3'>  <b>3.1 SECONDARY SCHOOL:</b> </font></td></tr>";

	$edd=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='left' width='40%'> &nbsp; ".strtoupper($institution)."</td> <td align='center' width='15%'> ".strtoupper($startYear)." </td> <td align='center' width='15%'> ".strtoupper($endYear)." </td>   <td align='center' width='30%'> ".strtoupper($degree)." </td>  </tr>";
		$edd++;
	}


//3.2
$q = "Select * from prob_education where applicant_id='$applicant_idgdef' and eduCat='Higher Institution'";
$qry2=mysqli_query($con, $q);
	//echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td colspan='4'><font color='black' size='3'>  <b>3.2 HIGHER INSTITUTION(S) ATTENDED, POLYTECHNIC/UNIVERSITY ETC:</b> </font></td></tr>";
	
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='left'> &nbsp; ".strtoupper($institution)."</td> <td align='center'> ".strtoupper($startYear)." </td> <td align='center'> ".strtoupper($endYear)." </td>   <td align='center'> ".strtoupper($degree)." ".strtoupper($course)." </td>  </tr>";
		$edd++;
	}



	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//4.0 professional bodies
$q = "Select * from prob_body where applicant_id='$applicant_idgdef'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>4.0 MEMBERSHIP OF ANY OTHER PROFESSIONAL INSTITUTION(S): (IF ANY)</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='center'><b> SN </td> <td align='center'><b> NAME OF INSTITUTION  </b></td> 	<td align='center'><b> CURRENT GRADE  </b></td>   <td align='center'><b> HOW MEMBERSHIP WAS ACHIEVED <br>(E.G. EXAMINATION) </b></td>   <td><b><center> YEAR REGISTERED/<br>OBTAINED/ELECTED </center></b></td> </tr>";

	$ed=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='center'>$ed</td> <td align='center'> ".strtoupper($institution)."</td> <td align='center'> ".strtoupper($currentGrade)." </td>   <td align='center'> ".strtoupper($regRoute)." </td>   <td align='center'> ".strtoupper($regYear)." </td>  </tr>";
		$ed++;
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//5.0 Logbook
$q = "Select * from prob_logbook where applicant_id='$applicant_idgdef'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>5.0 PATICULARS OF LOGBOOK/DIARY STAGE 1 PASSED </b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='left'> &nbsp; <b> DETAILS  </b></td> <td align='center'><b> YEAR/MONTH </b></td>   <td align='center'><b> EXAM. NO.<br>(WHERE APPLICABLE) </b></td>  <td><b><center> CENTER<br>(WHERE APPLICABLE) </center></b></td> </tr>";

	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		
		echo "<tr><td align='left'> &nbsp; LOGBOOK/DIARY STAGE 1 </td> <td align='center'> ".strtoupper($logbookMonth)." ".strtoupper($logbookYear)." </td>   <td align='center'>  </td>   <td align='center'>  </td>  </tr>";
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";


//6.0 GDE Exemption
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>6.0 PATICULARS OF EXEMPTION </b> </font></td></tr>";


echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='left'> &nbsp; <b> EXAMINATION  </b></td> <td align='left' colspan='3'> <b> &nbsp; COURSE</b></td> </tr>";
	
	echo "<tr><td align='left'> &nbsp; GDE  </td> <td align='left' colspan='3'> ";
		$q = "select * from exemptioncourse2020 where exam='GDE'";
		$r = mysqli_query($con, $q);
		$cx = 6;
		 
		//check old option
		$q2 = "select * from prob_exemption where applicant_id=$applicant_idgdef";
		$r2 = mysqli_query($con, $q2);
		$row2 = mysqli_fetch_array($r2);
		//extract($row2);
		//echo print_r($row2);
		
			echo "<table width='100%' border='1' cellspacing='0'>";
		while($row=mysqli_fetch_assoc($r))
		{
			$gname = "ex".$cx;
			extract($row);
			$mycell = "course".$cx;

			if($row2[$mycell]=="1"){ echo '<tr><td> &nbsp; '.strtoupper($course).'</td></tr>'; }
			
			$cx++;
		}	echo "</table>";
		
	echo " </td>  </tr>";
		
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";




//7.0 professional experience
$q = "Select * from prob_experience where applicant_id='$applicant_idgdef'";
$qry2=mysqli_query($con, $q);
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>7.0 PROFESSIONAL EXPERIENCE</b> </font></td></tr>";
echo "<tr><td colspan='3'> <br>";
	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td align='center'><b> SN </td> <td align='center'><b> EMPLOYER'S NAME AND ADDRESS  </b></td> <td align='center'><b> POSITION HELD & DATES  </b> <td align='center'><b> DUTIES </b></td> </tr>";
	
	$xp=1;
	while($row2=mysqli_fetch_array($qry2)){
		extract($row2);
		echo "<tr><td align='center'> $xp </td> <td align='center'> ".strtoupper($employer)."</td> <td align='center'> ".strtoupper($position)." ($startDate - $endDate) </td>   <td> <font size='2'>".strtoupper($duties)."</font> </td> </tr>";
		$xp++;
	}
	echo "</table>";
	
echo "</td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";


//8.0 Employer 
//$q = "Select * from prob_employer where applicant_id='$applicant_idgdef'";
$q = "Select * from prob_experience where applicant_id='$applicant_idgdef' and endDate='date'";
//echo $q;
$qry2=mysqli_query($con, $q);

if(($qry2) && (mysqli_num_rows($qry2)>0)){
	$rowEmployer=mysqli_fetch_array($qry2);
 	extract($rowEmployer);
}
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'>  <b>8.0 EMPLOYER DETAILS</b> </font></td></tr>";
	
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";

	echo "<tr><td width='40%'><b> &nbsp;  a)   NAME OF EMPLOYER: </b></td> 	<td colspan='2'> &nbsp;  ".$rowEmployer['employer']." </td></tr>";
	//echo "<tr><td><b> &nbsp;  b) EMPLOYER'S BUSINESS ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($rowEmployer['address'])." </td></tr>";
	echo "<tr><td><b> &nbsp;  b)  NATURE OF EMPLOYER'S BUSINESS: </b></td> 			<td colspan='2'> &nbsp;  ".$rowEmployer['nature']." </td></tr>";
	echo "<tr><td><b> &nbsp;  c)  POSITION OF APPLICANT: </b></td> 				<td colspan='2'> &nbsp;  ".$rowEmployer['position']." </td></tr>";
	echo "<tr><td><b> &nbsp;  d)  DATE OF EMPLOYMENT: </b></td> 				<td colspan='2'> &nbsp;  ".$rowEmployer['startDate']." </td></tr>";
	
	echo "</table>";

echo "</td></td>";
echo "<tr><td><b> <br> </b></td> 					<td colspan='2'>  </td></tr>";
	echo "<tr><td colspan='2'><b> f)  I hereby attest that to the best of my knowledge, the particulars given by me and the applicant here are true and correct.   </b></td> 	</tr>";
	echo "<tr><td><b>  </b></td> 				<td colspan='2' align='center'> <br><br><br><img src='images/line.jpg' width='70%'><br><b> EMPLOYER'S SIGNATURE & DATE </b>	 </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";




//9.0 sponsor
$q = "Select * from prob_sponsor where applicant_id='$applicant_idgdef'";
$qry2=mysqli_query($con, $q);
$row2=mysqli_fetch_array($qry2);
extract($row2);
$mysponsor = $memberSurname;

echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> <b>9.0 SPONSOR DETAILS</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";

	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td width='40%'><b> &nbsp;  a) SPONSOR'S NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> &nbsp;  ".strtoupper($memberNo)." </td></tr>";
	echo "<tr><td><b> &nbsp;  b)  SPONSOR'S FULL NAME: </b></td> 				<td colspan='2'> &nbsp;  ".strtoupper($memberSurname)." ".strtoupper($memberOthernames)." </td></tr>";
	echo "<tr><td><b> &nbsp;  c)  SPONSOR'S EMAIL ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberEmail)." </td></tr>";
	echo "<tr><td><b> &nbsp;  d)  SPONSOR'S CONTACT ADDRESS: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberAddress)." </td></tr>";
	echo "<tr><td><b> &nbsp;  e)  SPONSOR'S MEMBERSHIP GRADE: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberGrade)." </td></tr>";
	echo "<tr><td><b> &nbsp;  f)  SPONSOR'S RESGISTRATION DATE:: </b></td> 			<td colspan='2'> &nbsp;  ".strtoupper($memberRegDate)." </td></tr>";
	
	echo "</table>";

echo "</td></td>";
echo "<tr><td><b> <br> </b></td> 					<td colspan='2'>  </td></tr>";
	echo "<tr><td colspan='2'><b> g) I hereby declare that to the best of my knowledge, the particulars given by me and the applicant here are true and correct.   </b></td> 	</tr>";	
echo "<tr><td><b>  </b></td> 				<td colspan='2' align='center' width='50%'> <br><br><br><img src='images/line.jpg' width='70%'><br><b> SPONSOR'S SIGNATURE & DATE </b>	 </td></tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";

//10.0
/*
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> <b>10.0 DIVISION</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>  &nbsp;  $division </td></tr>";

echo "<tr><td colspan='3'><br>";

	echo "<table width='' border='1' cellspacing='0'>";
	echo "<tr><td><b> &nbsp;  SUBJECTS </b></td> 			</tr>";
	if(!empty($division))
	{
	   //get subjects
	   $q_sub = "select * from examdivision2020 where division='$division' AND exam='GDE'";
	   $r_sub = mysqli_query($con, $q_sub);
	   
	   $i = 1;
	   while($rows_subject = mysqli_fetch_array($r_sub))
	   {
	   	//extract($rows);
	   	echo "<tr><td> &nbsp; ".$i.". ".$rows_subject['subject']." &nbsp; </td></tr>";
	   	$i++;
	   }
	   
	   
	} 
	echo "</table>";

echo "</td></td>";
echo "<tr><td><b> <br> </b></td> 					<td colspan='2'>  </td></tr>";
*/
//11
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> &nbsp; <b>10.0 DECLARATION</b> </font></td></tr>";
echo "<tr><td colspan='2' align='justify'><br>I declare that the particulars given on this form are true and correct and that I will abide by the Rules and Regulations governing the Institute’s Examinations.   <br><br><br></td> 	</tr>";
echo "<tr><td colspan='2'><b>Applicant's Signature...................................................... Date..............................................    </b></td> 	</tr>";
echo "<tr><td><b> <br><br> </b></td> 						<td colspan='2'> </td></tr>";
//

//11.0
echo "<tr><td colspan='3' bgcolor='black'><font color='white' size='4'> &nbsp; <b>11.0 STATE CHAPTER CHAIRMAN/SECRETARY (COMPULSORY) TO BE COMPLETED MANUALLY</b> </font></td></tr>";
echo "<tr><td colspan='3'><br>";


	echo "<table width='100%' border='1' cellspacing='0'>";
	echo "<tr><td height='40px' width='30%'> &nbsp; <b> CHAPTER: </b></td> 	<td colspan='2' > &nbsp; &nbsp;  ".strtoupper($memberChapter)." <br> </td></tr>";
	echo "<tr><td> &nbsp;<b> NAME: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> NIQS MEMBERSHIP NUMBER: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> DESIGNATION: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> PHONE NUMBER: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> DATE: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> EMAIL: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "<tr><td> &nbsp;<b> SIGNATURE: </b></td> 	<td colspan='2'> <br><br> </td></tr>";
	echo "</table>";

echo "</td><tr>";


echo "</table>";


echo "<br><br>";
echo "<p align='justify'>By completing and submitting this application form, you agree to be bound by all existing NIQS Examination Policies, Rules and Guidelines and the rules guiding the ".$regSet." professional examination in particular.</p>";

?>
</div>

<?php 

//double check passport
if(!file_exists($mypassport))
{
   echo '<script>alert("Your passport is missing");</script>';
   echo '<script>history.back();</script>';
   exit();
}

//double check o'level subjects
/*
if($mysubjectcount < 5)
{
   echo '<script>alert("Your O-Level subjects is less than 5");</script>';
   echo '<script>window.location = "http://niqs.org.ng/onlineapplication/gdefull/index.php?page=olevel";</script>';
   exit();
} 
*/


//double check sponsor
if(empty($mysponsor)){
	//ok do nothing
   echo '<script>alert("Your sponsor details are missing");</script>';
   echo '<script>history.back();</script>';
   exit();
}

if($status == "Pending"){ echo "<b><font color='red'>NOTE: Please ensure that all information on this form is correct. You will not be able to edit this form once submitted.</font></b> <br><br><a href='?page=sponsor'><button class='btn'>Back</button></a> <a href='submitform.php?i=".$myAppID."'><button  class='btn' name='btnsubmit' id='btnsubmit'>Submit</button></a>";
}else{
	//echo "<a href='printform.php?i=$myAppID'><button name='btn' id='btn'>Print</button></a>";
	//print form
	echo "<form action='printform.php' method='post'>";
	echo "<input type='hidden' name='i' value='$myAppID' />";
	echo "<input type='submit' value='Print Form' />";
	echo "</form>";
}
 ?>  


	
<script>
function printform(){    
   var originalContents = document.body.innerHTML;
   document.getElementById('btn').style.display="none";
     var printContents = document.getElementById('myarea').innerHTML;      
   document.body.innerHTML = printContents;   
   window.print();     
   document.body.innerHTML = originalContents;
}
</script>