<div class="modal fade" id="editcontact<?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"> Update Contact &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $Fname ?></h4> 
            </div>
				<div class="modal-body">
			   
					<form name="contacts" data-parsley-validate class="form-horizontal form-label-left" method="post" action="">
					
					<input  type="text" style="display:none;" id="idr" name="idr" value="<?php echo $id ?>" required="required" class="form-control col-md-3 col-xs-3">
					<input  type="text" style="display:none;" id="fn" name="fn" value="<?php echo $Fname ?>" required="required" class="form-control col-md-3 col-xs-3">
					
					<table border="0" style="margin-left:40px">
					<tr> 
					 <div class="form-group">
                       <td> <label >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" class="form-control col-md-3 col-xs-3">
                        </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-6 col-sm-6 col-xs-5">
                          <input type="number" id="contact" name="contact"  value="<?php echo $pne ?>" required="required" class="form-control col-md-3 col-xs-3"><b style="color:green;">07XXXXXXXX</b>
                        </div> </td>
                      </div> </tr>
					  
					 <tr>  <div class="form-group">
                        <td><label  for="first-name"> Group <span class="required"> </span> </label> </td>
                        
                       <td>
					   <div class="form-group">
											<div class="col-md-4 col-sm-4 col-xs-5">
												<select class="form-control" name="group" reguired>
													<option value="<?php echo $gr; ?>"> <?php echo $gname; ?></option>
													<?php 
														$grps = mysql_query("select * from airtime_groups where customer_id = '$session_id' and group_id != '$gr' order by group_id");
															$numrows = mysql_num_rows($grps);
																if($numrows == 0){
														         echo ' <div class="col-md-offset-3 col-md-9">
																	<button id="btn-signup" type="button" class="btn btn-error"><i class="icon-hand-right"></i>Invalid You Have Not Created Any Group Yet! </button>
                                         
																	</div>';
																}
																else{
																	while($record = mysql_fetch_array($grps)){
		 
																	echo '<option value="' . $record['group_id'] .'">' . $record['name'] . '</option>';
																	}
																}
														
						 
													?>    
												</select>
											</div>
								</div>
					   
						</td>
                      </div> </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="updatex" value="Update"/>
								</div>
							</div>	
					  
							
					</form>
					<?php
					if(isset($_POST['updatex'])){
						
						$idt = $_POST['idr'];
						$fme= $_POST['fname'];
						$cnt = $_POST['contact'];
						$grup= $_POST['group'];
					
						if($grup != "--Assign Group--"){
							$sql = mysql_query("update airtime_contacts set fname = '$fme', contact = '$cnt', group_id = '$grup' where contact_id = '$idt' and customer_id = '$session_id' ") or die (mysql_error());	
							if($sql){
							    
							    
							    ?>
				                	<script>
				                    	window.location="save_editlog.php?nm=<?php echo $fme; ?>";
					                </script>
					        	<?php
							
			
							}
						}
						else{
							echo " Select Group To update this contact!";
						}
					
					}
					
					?>
					
				</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>