<?php
//update 
			if(isset($_POST["disability"]))
			{
			   //updated profile
			   extract ($_POST);
			   //print_r($_POST);

			   $q2 = "update pci_application set disability='$disability', disability_type='$disability_type' where id=$applicant_idpci limit 1";
			   $r2 = mysqli_query($con, $q2);
			   
			   if(!$r2){
				   //echo mysqli_error($con); 
				   $errmsg = "Disability Status was not updated, please fill the form correctly";
				 } else {
				   $sucmsg = "Disability Status updated successfully"; 
			    }
			   
			}
                
?>

<div class="graph-visual tables-main">
<h2 class="inner-tittle">DISABILITY</h2> 
	<div class="graph-form">
    		<div class="form-body">
    			<form method="post" name="disabilityform" action="index.php?page=disability"> 
                <?php 
                if($errmsg!=''){
                    echo '<div class="alert alert-danger">'.$errmsg.'</div>';
                }elseif($sucmsg!=''){
                    echo '<div class="alert alert-success">'.$sucmsg.'</div>';
                }
                

				
                   //GET DETAILS FROM DB

		    $q = "Select * from pci_application where id=$applicant_idpci limit 1";
		    $qry=mysqli_query($con, $q);
		    $row=mysqli_fetch_assoc($qry);
		    extract($row);
		    
		    if(strlen($disability_type)>0){ $dis_available = "Yes"; $mydisability=$disability_type; }else{ $dis_available = "No"; }
         
                
                ?>	
                	<label>Do you have any disability? </label>
                   	 <select name="disability" class="form-control" style="height:auto" required="required">
                   		<option value="">-select option-</option>
			  			<option <?php if($disability == "YES"){ echo "selected"; } ?>>YES</option>
			  			<option <?php if($disability == "NO"){ echo "selected"; } ?>>NO</option>
			  		
			  </select>
			  <br />

					<label>If your answer above is YES, kindly specify the disability </label>
                   	<input type="text" name="disability_type" <?php if(strlen($mydisability)>0){ echo " value='".$mydisability."'"; } ?> class="form-control" />
			
                    <input name="updateDisability" type="submit" class="btn btn-default" value="Update Disability Status"/> 
                </form> 
			
			
		

    		</div>
    
    </div>

</div>
<div>
<a href='?page=passport'><button class='btn'>Back</button></a>
<?php
//check disability

if(strlen($disability)>0 && $disability == "YES" && strlen($disability_type)>0)
{
  	echo "<a href='?page=olevel'><button class='btn'>Next</button></a>";
}elseif(strlen($disability)>0 && $disability == "NO"){
	echo "<a href='?page=olevel'><button class='btn'>Next</button></a>";
} 

?>
</div>


