<?php session_start();
if($_SESSION){
?>
<?php
error_reporting(0);
 $_GET['i'];
 $_GET['n'];
 $_GET['a'];
 $_GET['p'];
 $_GET['e'];

 $_GET['im'];
 $_GET['r'];
?>
<!DOCTYPE html>
<html>
<head>
	<title>addvenue</title>



  <!--Custom styles-->
  <link rel="stylesheet" type="text/css" href="styles.css">
  <style type="text/css">
    /* Made with love by Mutiullah Samim*/




.imagePreview {
    width: 100%;
    height: 180px;
    background-position: center center;
  background:url(http://cliquecities.com/assets/no-image-e3699ae23f866f6cbdf8ba2443ee5c4e.jpg);
  background-color:#fff;
    background-size: cover;
  background-repeat:no-repeat;
    display: inline-block;
  box-shadow:0px -3px 6px 2px rgba(0,0,0,0.2);
}
.btn-primary
{
  display:block;
  border-radius:0px;
  box-shadow:0px 4px 6px 2px rgba(0,0,0,0.2);
  margin-top:5px;
}
.imgUp
{
  margin-bottom:15px;
}
.del
{
  position:absolute;
  top:0px;
  right:15px;
  width:30px;
  height:20px;
  text-align:center;
  line-height:30px;
  background-color:rgba(255,255,255,0.6);
  cursor:pointer;
}
.imgAdd
{
  width:25px;
  height:20px;
  border-radius:50%;
  background-color:#4bd7ef;
  color:#fff;
  box-shadow:0px 0px 2px 1px rgba(0,0,0,0.2);
  text-align:center;
  line-height:10px;
  margin-top:0px;
  cursor:pointer;
  font-size:15px;
}
.uploadFile{
  width: 5px;
  height: 5px;
}

</style>
</head>
<body style="background-color: #5499C7;">
 <?php include 'adminheader.php';?><br><br><br><br><br>






<center>
<div class="container " >
  <h3 class="text-red" style="text-align: center;color:red;font-family:Monotype Corsiva;font-size: 50px;"><b>Update venue </b></h3>
 
  
  <form action="" method="get"enctype="multipart/form-data">
 	   <div class=" form-group row col-lg-8">
          
          <input type="hidden" class="form-control" name="id" placeholder="id" value="<?php echo $_GET['i']; ?>" required>
        
          </div>
		  <div class=" form-group row col-lg-8">
             <label for="email"  style="font-size: 20px; color: white "><b>Event Type: </b> </label>
          <input type="text" class="form-control" name="event" placeholder="Venu Name" value="<?php echo $_GET['e']; ?>" required>
        
          </div>
     <div class=" form-group row col-lg-8">
             <label for="email"  style="font-size: 20px; color: white "><b>Venu Name: </b> </label>
          <input type="text" class="form-control" name="name" placeholder="Venu Name" value="<?php echo $_GET['n']; ?>" required>
        
          </div>
          <div class="form-group row col-lg-8">
             <label for="email"  style="font-size: 20px; color: white "><b>Venu Address:</b></label>
          <input type="text" class="form-control" name="address" placeholder="Venu Address" value="<?php echo $_GET['a']; ?>" required>
        
          </div>
           <div class="form-group row col-lg-8">
             <label for="email"  style="font-size: 20px; color: white "><b>Venu phone No:</b></label>
          <input type="text"class="form-control" name="phone" placeholder="Venu phone No" value="<?php echo $_GET['p']; ?>" required>
        
          </div>
           
 
            
        
                     <div class="form-group row col-lg-8">
             <label for="email"  style="font-size: 20px; color: white "><b>Rs:</b></label>
          <input type="text" class="form-control" name="rs" placeholder=" Rs." value="<?php echo $_GET['r']; ?>" required>
        
          </div>
        
       
<!--
  <div class="row row col-lg-12"> <label for="email"  style="font-size: 20px; color: white "><b>image:</b></label>
  <div class="col-sm-2 imgUp">
    <div class="imagePreview"></div><br>
<label class="btn btn-primary">
                Upload<input type="file" class="uploadFile " name="upload" value="Upload Photo" style="width: 7px;height: 5px;overflow: hidden; " value="<?php //echo $_GET['im']; ?>" >
                                                      
                </label>
  </div> 
  <i class="fa fa-plus imgAdd"></i>
 </div>-->



          <center>
    <button type="submit" name="Update" value="Update" class="btn btn-primary" style="text-align: center; font-size: 20px">Update</button></center>
  </form>
</div>
</center>
<?php
if ($_GET['Update']) {
	$id = $_GET['id'];
	$name = $_GET['name'];
	$address = $_GET['address'];
	$phone = $_GET['phone'];
	$capacity = $_GET['capacity'];
	$event = $_GET['event'];
	$rs = $_GET['rs'];

	//$filename= $_FILES["upload"]["name"];
//$tmpname= $_FILES["upload"]["tmp_name"];
//$folder ="event_img/".$filename;

//hash_update_file($tmpname, $folder);
	

	 $conn = new mysqli("localhost","root","","event");
	$query ="Update add_shows_event set name='".$name."', address='".$address."', phone='".$phone."', capacity='".$capacity."', event='".$event."',rs='".$rs."'where  id='".$id."'";
	$data=mysqli_query($conn,$query);
	if ($data) {
		echo "<script>window.top.location='shows_events_display.php';</script>";

	} else {
		echo "Record Not Updated";
	}
	
}else{
	echo "<font color='blue'>click on Update button to save the changes";
}
?>




<script type="text/javascript">
         $(".imgAdd").click(function(){
  $(this).closest(".row").find('.imgAdd').before('<div class="col-sm-2 imgUp"><div class="imagePreview"></div><label class="btn btn-primary">Upload<input type="file" class="uploadFile img" value="Upload Photo" style="width:7px;height:5px;overflow:hidden;"></label><i class="fa fa-times del"></i></div>');
});
$(document).on("click", "i.del" , function() {
    $(this).parent().remove();
});
$(function() {
    $(document).on("change",".uploadFile", function()
    {
            var uploadFile = $(this);
        var files = !!this.files ? this.files : [];
        if (!files.length || !window.FileReader) return; // no file selected, or no FileReader support
 
        if (/^image/.test( files[0].type)){ // only image file
            var reader = new FileReader(); // instance of the FileReader
            reader.readAsDataURL(files[0]); // read the local file
 
            reader.onloadend = function(){ // set image data as background of div
                //alert(uploadFile.closest(".upimage").find('.imagePreview').length);
uploadFile.closest(".imgUp").find('.imagePreview').css("background-image", "url("+this.result+")");
            }
        }
      
    });
});
</script>
</body>
</html>
<?php
  }
  else{
    echo "<script>
   alert('You have to  login first...!');
   window.location.href='event2.php';
   </script>";
  }
  
?>