<?php 	include_once('../../config.php');   	
		include_once(ABS_PATH.'/admin/login_check.php');    
    
	    if(isset($_POST['submitF']))
		{         
	 	 		
			$stmt=$conn->prepare("update    UI__DChstr set ManualSet=:ManualSet,ManualAmt=:ManualAmt,ManualSet2=:ManualSet2,ManualAmt2=:ManualAmt2 where id=:id  ");    
            $stmt->bindValue(':ManualSet', $_POST['mDys'] , PDO::PARAM_STR);  
            $stmt->bindValue(':ManualAmt', $_POST['mAmt'] , PDO::PARAM_STR); 
            $stmt->bindValue(':ManualSet2', $_POST['mDys2'] , PDO::PARAM_STR);  
            $stmt->bindValue(':ManualAmt2', $_POST['mAmt2'] , PDO::PARAM_STR);  
            $stmt->bindValue(':id',$_REQUEST['TpId'], PDO::PARAM_STR);      
            $stmt->execute(); 
            header("Location: registered_usersSetting.php?cuurentId=".$_REQUEST['cuurentId'] );
            die; 
		}
			 
        
?>  
<?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> Edit Top Up   </h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='registered_users.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm"> 
							   	 
							   	 
							   	 <?php  
							   	        
                                        $stmt=$conn->prepare("select  amt, ManualSet,ManualAmt,id,ManualSet2,ManualAmt2    from  UI__DChstr  where id=:TpId   ");  
                                        $stmt->bindValue(':TpId', $_REQUEST['TpId'] , PDO::PARAM_STR);
                                        $stmt->execute(); 
                                        $tp = $stmt->fetch(PDO::FETCH_OBJ);   
                                        
                                        //foreach($AllUsers as $tp)
                                        {

							   	 ?>
							   	 
							   	 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">User Top</label>
								    <div class="col-sm-3"> 
                                            <input name="nm" type="number" class="form-control"   placeholder="Username"  readonly    value="<?php echo $tp->amt; ?>"  >  
								            
								    </div>
								 </div>
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Manul Days 1 </label>
								    <div class="col-sm-3"> 
                                            <input name="mDys2"  type="number"class="form-control"         value="<?php echo $tp->ManualSet2; ?>"  >   
								    </div>
								 </div>
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Manul Amount  1</label>
								    <div class="col-sm-3"> 
                                            <input name="mAmt2"   type="number" class="form-control"          value="<?php echo $tp->ManualAmt2; ?>"  >  
								            
								    </div>
								 </div>
								 
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Manul Days 2 </label>
								    <div class="col-sm-3"> 
                                            <input name="mDys"  type="number"class="form-control"         value="<?php echo $tp->ManualSet; ?>"  >   
								    </div>
								 </div>
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Manul Amount 2 </label>
								    <div class="col-sm-3"> 
                                            <input name="mAmt"   type="number" class="form-control"          value="<?php echo $tp->ManualAmt; ?>"  >  
								            
								    </div>
								 </div>
								 
								 
								    
								 <hr> 
								 
								 <?php  } ?>
    							 
    								 	 
								 
								  <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">
										  <input type="hidden" value="<?php echo $AllUsers->cuurentId?>"  name="Ccid"/> 
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


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

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

    /*$stmt=$conn->prepare("select  utilities,id from  UI__Rgst   "); 
                            $stmt->execute(); 
                            $AllUsers = $stmt->fetchAll(PDO::FETCH_OBJ);   
                          
                          
                            foreach($AllUsers as $amp)
                            {
                                $tc = null;
                                $tc = explode(",",$amp->utilities); 
                                $tc[2]  = 0;  
                                $str = implode(",",$tc);
                                $stmt=$conn->prepare("update  UI__Rgst set  utilities=:utilities where id=:id "); 
                                $stmt->bindValue(':utilities', $str , PDO::PARAM_STR);
                                $stmt->bindValue(':id', $amp->id , PDO::PARAM_STR);
                                $stmt->execute();   
                            }   */
                           
                            
?>    