<?php 	include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');    
 
  
			if(isset($_POST['submitF']))
			{      
    			
    			unlink(ABS_PATH.'/uploads/QrCode/'.$_POST['QrHidden']);		
                $ext = explode('.', basename($_FILES['Qr']['name']));//explode file name from dot(.)  
                $Fname =  substr(md5(uniqid()),26).".". $ext[count($ext) - 1];  
                $target_path = ABS_PATH."/uploads/QrCode/".$Fname;//set the target path with a new name of image 
                move_uploaded_file($_FILES['Qr']['tmp_name'], $target_path);      			 
    			 
    			$stmt=$conn->prepare("update  UI__Rgst set  UPI2=:UPI  where id=:id  "); 
                $stmt->bindValue(':UPI',$Fname, PDO::PARAM_STR);  
                $stmt->bindValue(':id',$_REQUEST['id'], PDO::PARAM_STR);    
                $stmt->execute();   
				header("Location: Qr_users.php ");  
				die;
			}    
        
            $stmt=$conn->prepare("select  UPI from  UI__Rgst where id=:id ");  
            $stmt->bindValue(':id', $_REQUEST['id'] , PDO::PARAM_STR);
            $stmt->execute(); 
            $AllUsers = $stmt->fetch(PDO::FETCH_OBJ);   
            $sr = 1;    
		 
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
	}); 
  
	$(document).ready(function()
	{   

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			city:{
				required:true				 
			} 
			
			
			
		},
		messages:{				
			 
			 city:{
				required:"Enter city name"				 
			} 
		}
	});


	});
 


</script>
		 
		 <div class="col-md-10">

	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3> Upload Qr Details</h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='Qr_users.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm"> 
							   	 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Upload Rq</label>
								    <div class="col-sm-6">
								      <input name="Qr" type="file" class="form-control"   required   >
								      <input name="QrHidden" type="hidden" class="form-control"   value="<?php echo $AllUsers->UPI;?>"   >  
								    </div>
								 </div>
								 <hr>
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-6">
										  <input type="submit"    class="btn btn-primary"  name="submitF" value="Update">
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


	  		<!--  Page content -->
		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    