<?php 	
            include_once('../../config.php');  
  
  
  
			if(isset($_POST['submitF']))
			{    
                
                $ext = explode(".",$_FILES['Banner']['name']);//explode file name from dot(.)   
                $Fname =  substr(md5(uniqid()),26).".".end($ext);  
                $target_path = ABS_PATH."/uploads/banners/".$Fname;//set the target path with a new name of image 
                move_uploaded_file($_FILES['Banner']['tmp_name'], $target_path);
                
                
                $stmt=$conn->prepare("insert into  UI__Banners (name,Tdate,status,type) values(:name,:Tdate,1,1)  ");     
                $stmt->bindValue(':name', $Fname , PDO::PARAM_STR); 
                $stmt->bindValue(':Tdate', date("d-M-Y") , PDO::PARAM_STR); 
                $stmt->execute();     
				header("Location: DwnBanners.php");  
				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> Add New Banner</h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='Banners.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">Name</label>
								    <div class="col-sm-3">
								      <input name="Banner" class="form-control" type="file"   required  >
								    </div>
								 </div>
								 <hr>
								   
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Active</label>
								    <div class="col-sm-3">
								      <select class="form-control" name="Isactive">
								          <option value="1" <?php if($starlineRT->is_active==1) echo "selected";?> > Active</option>
								          <option value="0" <?php if($starlineRT->is_active==0) echo "selected";?> > Inactive</option>
								      </select>
								    </div>
								 </div>
								 <hr>
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-10">
										  <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';	?>    