<div class="modal fade" id="updatecontact<?php echo $id ?>" tabindex="-1" role="form" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> Cancel &times;</button>
                <h4 class="modal-title" id="myModalLabel"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
				<?php $Fname = $dat['fname']; $Lname = $dat['lname'];$phne = $dat['phone'];$user = $dat['username'];$mail = $dat['email'];echo $Fname."  ". $Lname ?></h4> 
            </div>
				<div class="modal-body">
			   
					<form name="contacts" data-parsley-validate class="form-horizontal form-label-left" method="post" action="">	
					<table border="0" style="margin-left:80px">
					<div style="margin-top:-50px;" >
					<tr> 
					 <div class="form-group">
                       <td> <label > First Name <span class="required"> </span>
                        </label> </td>
                        <td> <div class="col-md-4 col-sm-4 col-xs-5">
                          <input type="text" id="fname" name="fname" value="<?php echo $Fname ?>" required="required" size="25px" >
                        </div> </td>
                      </div> 
				     </tr>
					 </div>
					 <tr>
					  <div class="form-group">
                       <td> <label for="first-name">Last Name <span class="required"> </span>
                        </label> </td>
                      <td>  <div class="col-md-4 col-sm-4 col-xs-5">
                          <input type="text" id="lname" name="lname" required="required"  value="<?php echo $Lname ?> "size="25px" >
                        </div> </td>
                      </div> 
					  </tr>
					  <tr>  
					  <div class="form-group">
                       <td><label for="first-name">Username <span class="required"> </span>
                        </label> </td>
                        <td><div class="col-md-4 col-sm-4 col-xs-5">
                          <input type="text" id="username" name="username"  value="<?php echo $user ?>" required="required" size="25px" >
                        </div> </td>
                      </div> 
					  </tr>
					   
					  <tr><div class="form-group">
                       <td> <label  for="first-name"> Contact <span class="required"> </span>  </label> </td>
                       
                       <td> <div class="col-md-4 col-sm-4 col-xs-5">
                          <input type="number" id="contact" name="contact"  value="<?php echo $phne ?>" required="required" size="25px" >
                        </div> </td>
                      </div> </tr>
					 <tr> <div class="form-group">
                       <td> <label  for="first-name">Email <span class="required"> </span>  </label> </td>
                       
                       <td> <div class="col-md-4 col-sm-4 col-xs-5">
                          <input type="email" id="email" name="email"  value="<?php echo $mail ?>" required="required" size="25px" >
                        </div> </td>
                      </div> 
					  </tr>
					  </table>
					  <br/> <br/>
					  
					  <table border="0" style="margin-left:80px">
							<tr>
								<td>   Upload photo:   </td> <td> <div style="margin-top:-16px;margin-left:10px;" > &nbsp;&nbsp;   <input type="file" name="file" id="file" /><input type="hidden" name="image"  /> </div> </td>
							</tr>
					  </table>
						<br/>
							<div class="form-group" style="margin-left:80px;">
								<div class="col-md-4col-sm-4 col-xs-5 col-md-offset-3">
									<input type="submit"  class="btn btn-success" name="update" value="Update"/>
								</div>
							</div>	
					  
							
					</form>
					<?php
					if(isset($_POST['update'])){
						
						$fme= $_POST['fname'];
				        $lme=$_POST['lname'];
						$cnt = $_POST['contact'];
						$eml = $_POST['email'];
						$user=$_POST['username'];
											 
						if($fme != null && $lme != null && $cnt != null && $eml != null && $user != null){
							$sql = mysql_query("update airtime_customer set fname='$fme', lname='$lme', username='$user', phone='$cnt', email='$eml' where customer_id = '$session_id' ") or die (mysql_error());	
					        
					        if($sql){
					            $qry = mysql_query("select * from airtime_logs where id = '$session_lid' ");
						    	$sdata = mysql_fetch_array($qry);
						    	$actions = $sdata['user_actions'];
						    	mysql_query("update airtime_logs set user_actions = '$actions Updated Account Profile information.' where id = '$session_lid'  ");
					        }
						}
						else{
							echo " Fill all required Fields!";
						}
							
						
						?>
					<script>
					window.location="profile.php";
					</script>
						<?php
					}
					
					?>
					
				</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>