<?php
$errmsg='';
$sucmsg='';
if(isset($_POST['addInstituttion'])){
    extract($_POST);
    $errmsg='';
    $sucmsg='';
    
	//print_r($_POST);
		
	//insert record
	$qry2=mysqli_query($con, "insert into pci_education values('', '$applicant_idpci', '$institution', '$country', '$degree', '$course', '$dateCompleted')");
	if($qry2){
		$sucmsg='Successful!';
	}else{
		//echo mysqli_error($con);
		$errmsg='Not Successful!';
	}
	
    
}



?>

<div class="graph-visual tables-main">
<h2 class="inner-tittle">EDUCATION (TERTIARY)</h2>
	 Please list all academic qualification(s). <BR>For each qualification, please indicate if you studied for the full duration of the course or whether you gained advanced entry to the course. If you gained advanced entry, which year of the course did you enter at (e.g. year 3 of a possible 5)?
	<div class="graph-form">
    		<div class="form-body">
		
    		<?php
				//GET DETAILS FROM DB
	
				$q = "Select * from pci_education where applicant_id='$applicant_idpci'";
				$qry=mysqli_query($con, $q);
				if($qry){
					
					if(mysqli_num_rows($qry) >0){
						$yyy = 1;
						echo "<table width='100%' border='0'>";
						echo "<tr><td colspan='5'>";
						echo "<table width='100%' border='1'>";
						echo "<tr><td><b>SN</b></td> <td><b>Institution </b></td>  <td><b>Country </b></td>  <td><b>Degree Obtained </b></td>  <td><b>Date Completed</b></td> <td><b>Action</b></td> </tr> ";
						
						while($row=mysqli_fetch_assoc($qry))
						{
							extract($row);
							echo "<tr><td>$yyy</td> <td>$institution </td> <td>$country </td> <td>".strtoupper($degree)." in $course </td> <td>$dateCompleted</td> <td> <form method='post' action='index.php?page=educationeditor'><input type='hidden' value='$id' name='editID'><input type='submit' value='Edit'></form> </td></tr>";
							$yyy++;
						}
						
						echo "</tables></td></tr>";
						echo "</tables> ";
						
					}else{ $errmsg=''; }
							
				}else{
					$errmsg='';
				}
				
				?>
			
			
			
			
    			<form method="post" name="educationform" action="index.php?page=education"> 
                <?php 
                if($errmsg!=''){
                    echo '<div class="alert alert-danger">'.$errmsg.'</div>';
                }elseif($sucmsg!=''){
                    echo '<div class="alert alert-success">'.$sucmsg.'</div>';
                }
                
                ?>
                    <div class="form-group"> 
                        <label>Institution</label> 
                        
<script>
 function mysch() {
   var sch = document.getElementById("institution").value;
   var sch2= document.getElementById("institution2");
   var mycountry = document.getElementById("mycountry");
   
   
   if(sch == "Others"){
     sch2.value = "";
     sch2.type = "text";
     mycountry.value = "";

   } else {
     sch2.value = sch;
     sch2.type = "hidden";
     mycountry.value = "Nigeria";
   }

 }
</script>
                        <select class="form-control" name="institution" id="institution" onchange="mysch()" style="height:auto" >
			<option>Abia State Polytechnic Aba, Abia State</option>
			<option>Abubakar Tafawa Balewa University, Bauchi, Bauchi State</option>
			<option>AbubakarTatari All Polytechnic, Bauchi, Bauchi State</option>
			<option>Ahmadu Bello University, Zaria, Kaduna State</option>
			<option>Akanu Ibiam Federal Polytechnic Uwana-Afikpo, Ebonyl State</option>
			<option>Akwa lbom State Polytechnic, lkot-Osurua, Akwa Ibom State</option>
			<option>Auchi Polytechnic, Auchi, Edo State</option>
			<option>Bayero University, Kano, Kano State</option>
			<option>Bells University of Technology, Ota, Ogun State</option>
			<option>Caleb University, Imota, Lagos State</option>
			<option>Crown PolytechnicAdo Ekiti, Ekiti State</option>
			<option>Delta State Polytechnic Ozoro, Delta State</option>
			<option>Enugu State University of Science and Technology, Enugu</option>
			<option>Federal Polytechnic Ado Ekiti, Ekiti State</option>
			<option>Federal Polytechnic Bauchi, Bauchi State</option>
			<option>Federal Polytechnic Bida, Niger State </option>
			<option>Federal Polytechnic Ede, Osun State</option>
			<option>Federal Polytechnic Ilaro, Ogun State</option>
			<option>Federal Polytechnic Kaura Namoda, Zamfara State</option>
			<option>Federal Polytechnic ldah, Kogi State</option>
			<option>Federal Polytechnic Nekede, Imo State</option>
			<option>Federal Polytechnic Offa, Kwara State</option>
			<option>Federal Polytechnic Oko, Anambra State</option>
			<option>Federal Polytechnic Ukana, Ukana Ikot, Ntuen, Akwa Ibom State</option>
			<option>Federal Polytechnic, Nasarawa, Nasarawa State</option>
			<option>Federal University of Technology Minna, Niger State</option>
			<option>Federal University of Technology Owerri, Imo State</option>
			<option>Federal University of Technology, Akure, Ondo State</option>
			<option>Fidei Polytechnic Gboko, Benue State</option>
			<option>Gregory University Uturu, Abia State</option>
			<option>Hassan Usman Polytechnic, Kastina</option>
			<option>Heritage Polytechnic, Eket,Akwa lbom State</option>
			<option>Imo State University, Owerri, Imo State</option>
			<option>Institute of Management and Technology, Enugu, Enugu State</option>
			<option>Jigawa State Polytechnic, Dutse, Jigawa State</option>
			<option>Joseph Ayo Babalola University, Ikeji-Arakeji, Osun State</option>
			<option>Kaduna Polytechnic, Kaduna, Kaduna State</option>
			<option>Kaduna State U n iversity, Kaduna</option>
			<option>Kano State Polytechnic, Kano, Kano State</option>
			<option>Kwara State Polytechnic Ilorin, Kwara State</option>
			<option>Lagos State Polytechnic,lkorodu, Lagos State</option>
			<option>MoshoodAbiola Polytechnic, Abeokuta, Ogun State</option>
			<option>Niger State Polytechnic, Niger State</option>
			<option>Nigerian Army Military School of Military Engineering, Makurdi, Benue State</option>
			<option>Nnarndi Azikiwe University, Awka, Anambra State</option>
			<option>Nuhu Bamali Polytechnic, Zaria, Kaduna State</option>
			<option>Obafemi Awolowo University, Ile-Ife, Osun State</option>
			<option>Osun State College of Technology, Esa-Oke, Osun State</option>
			<option>Osun State Polytechnic, Iree, Osun State</option>
			<option>Plateau State Polytechnic, Plateau State</option>
			<option>Ramat Polytechnic, Maiduguri, Borno State</option>
			<option>Rivers State University of Science and Technology, Port-harcourt, Rivers State</option>
			<option>Rufus Giwa Polytechnic, Owo, Ondo State</option>
			<option>The Polytechnic of Sokoto State, Sokoto</option>
			<option>The Polytechnic, Ibadan, Oyo State</option>
			<option>University of Benin, Benin, Edo State</option>
			<option>University of Birnin Kebbi, Kebbi State</option>
			<option>University of Ilorin, Ilorin, Kwara State</option>
			<option>University of Jos, Plateau State</option>
			<option>University of Lagos, Lagos State</option>
			<option>University of Uyo, Akwa lbom State</option>
			<option>Waziri Umaru Federal Polytechnic, Birnin Kebbi, Kebbi State</option>
			<option>Yaba College of Technology, Yaba, Lagos State</option>
			<option>Others</option>
                        </select> <br>
<input type="hidden" class="form-control" name="institution" id="institution2" placeholder="name of institution" required="" />

                    </div> 
                    
					<div class="form-group"> 
                        <label>Country</label> 
                        <input type="text" class="form-control" name="country"  id="mycountry" required="" /> 
                    </div> 
                    
					<div class="form-group"> 
                        <label>Degree Obtained</label> 
                        <input type="text" class="form-control" name="degree" placeholder="e.g B.TECH, BSc, HND" required="" /> 
                    </div> 
					
					<div class="form-group"> 
                        <label>Course</label> 
                        <input type="text" class="form-control" name="course" value="QUANTITY SURVEYING" required="" /> 
                    </div> 
					
					<div class="form-group"> 
                        <label>Date Completed</label> 
                        <input type="date" class="form-control" name="dateCompleted" required="" style="height:auto"/>  
                    </div> 
                   
                    
                    <input name="addInstituttion" type="submit" class="btn btn-default" value="Add Record"/> 
                    
                </form> 
                
    		</div>
    		
    
    </div>
    
    
  </div>  
   
<?php

 echo "<div>";
 echo "  <a href='?page=olevel'><button class='btn'>Back</button></a>"; 
 echo "  <a href='?page=body'><button class='btn'>Next</button></a>"; 
 echo "</div>";

?>




