<?php
$errmsg='';
$sucmsg='';
if(isset($_POST['addInstituttion'])){
    extract($_POST);
    $errmsg='';
    $sucmsg='';
    
	//print_r($_POST);
		
	//insert record
	$qry2=mysqli_query($con, "update epci_education SET institution='$institution', country='$country', degree='$degree', course='$course', dateCompleted='$dateCompleted' where applicant_id='$applicant_idpci' AND id=$editID");
	if($qry2){
		$sucmsg='Successful!';
		echo '<script>window.location = "index.php?page=education";</script>';
	}else{
		//echo mysqli_error($con);
		$errmsg='Not Successful!'.mysqli_error($con);
	}
	
    
}



?>

<div class="graph-visual tables-main">
<h2 class="inner-tittle">EDUCATION (SECONDARY SCHOOL / TERTIARY)</h2>
	 Please list all academic qualification(s). 
	<div class="graph-form">
    		<div class="form-body">
		
    		<?php
				//GET DETAILS FROM DB
				if(isset($_POST['editID'])){ $editID=$_POST['editID']; }else{ $editID="0"; }
				$q = "Select * from epci_education where applicant_id='$applicant_idpci' AND id=$editID";
				$qry=mysqli_query($con, $q);
				if($qry){
					
					if(mysqli_num_rows($qry) >0){
						$row=mysqli_fetch_assoc($qry);
						extract($row);
						$sucmsg='Edit the details below then click <b>Update Record</b>';
						
					}else{ $errmsg='No record found!'; }
							
				}else{
					$errmsg='No record found!';
				}
				
				?>
			
			
			
			
                <?php 
                if($errmsg!=''){
                    echo '<div class="alert alert-danger">'.$errmsg.'</div>';
                }elseif($sucmsg!=''){
                    echo '<div class="alert alert-success">'.$sucmsg.'</div>';
                
                
                ?>
    		
    		
    		<form method="post" name="educationform" action="index.php?page=educationeditor"> 
                    <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 selected><?php echo $institution; ?></option>
			<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 University, 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="" />

                        <input type='hidden' value='<?php echo $id; ?>' name='editID'>  
                    </div> 
                    
					<div class="form-group"> 
                        <label>Country</label> 
                        <input type="text" class="form-control" name="country"  value="<?php echo $country; ?>" required="" /> 
                    </div> 
                    
					<div class="form-group"> 
                        <label>Degree Obtained</label> 
                        <input type="text" class="form-control" name="degree"  value="<?php echo $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="<?php echo $course; ?>" value="QUANTITY SURVEYING" required="" /> 
                    </div> 
					
					<div class="form-group"> 
                        <label>Date Completed</label> 
                        <input type="date" class="form-control" name="dateCompleted"  value="<?php echo $dateCompleted; ?>" required="" style="height:auto"/>  
                    </div> 
                   
                    
                    <input name="addInstituttion" type="submit" class="btn btn-default" value="Update Record"/> 
                    
                </form> 
                
    		</div>
    		
    		<?php
    		 }
    		  ?>
    
    </div>
    
    
  </div>  
   
   
<div>
<a href='?page=education'><button class='btn'>Back to Education</button></a>
</div>

