<?php 	include_once('../../config.php'); 
		 

			if(isset($_POST['submit']))
			{   
				 
				$stmt=$conn->prepare("update   pw__cities set name=:name , is_active=:is_active where id=:id ");
                $stmt->bindValue(':name', $_POST['name'], PDO::PARAM_STR); 			  
                $stmt->bindValue(':is_active', $_POST['status'], PDO::PARAM_STR); 			  
                $stmt->bindValue(':is_active', $_POST['status'], PDO::PARAM_STR); 			  
                $stmt->bindValue(':id', $_REQUEST['id'], PDO::PARAM_STR); 			  
                $stmt->execute();    
				header("Location: cities.php ");  
				die;
			}   
			
			$stmt=$conn->prepare("select  * from    pw__cities 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() {
		$( "#dateselect" ).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> Add New Record </h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='labor.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete="off"> 
								
							 
								 
								 
								 
								 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">City Name</label>
								    <div class="col-sm-3" name="year"> 
									  <input name="name"   class="form-control"   placeholder="City Name"    value="<?php echo $AllUsers->name;?>" required>
								    </div>
								 </div>
								 <hr>
								  
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Status</label>
								    <div class="col-sm-3"> 
									  <select  class="form-control" name="status"  > 
									  <option value="1" <?php if($AllUsers->is_active==1) echo "selected";?>>Active</option> 
									  <option value="0" <?php if($AllUsers->is_active==0) echo "selected";?>>Inactive</option>  
									  </select>
									  
								    </div>
								 </div>
								 <hr>     
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Add User</label>
										<div class="col-sm-10">
										  <input type="submit"    class="btn btn-primary"  name="submit" value="Add City">
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


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

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