<?php session_start();
  if($_SESSION){
    
?>
<html>
<head>
  <title> Event_1 </title>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="bootstrap-checkbox-radio-list-group-item.min.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

  <link rel="stylesheet" href="bootstrap.min.css">

<link rel="stylesheet" href="font-awesome.min.css">
<style type="text/css">
  td{
    color: black;
  }
  th{
    color: black;
    font-family:Monotype Corsiva;
    font-size: 30px;
  }
  #myInput {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 12px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
}
</style>
</head>

<body>
 <?php include 'adminheader.php';?><br><br>

 <h3 class="text-red" style="text-align: center;color:black;font-family:Monotype Corsiva;font-size: 30px;"><b> Wedding_Events_1 </b></h3>
                                                                                        
    <div class="container">
  <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for event ID...." title="Type in a ID">
       <?php
  error_reporting(0);
     $conn = new mysqli("localhost","root","","event");
     $CID= $_SESSION['user_details']['id'];
     //$query=" SELECT * FROM book join SELECT id FROM signup";
      $query="SELECT * FROM eqi2";
     $data=mysqli_query($conn,$query);
    
     
     
     
      ?>
  <table class="table table-striped table-hover" id="myTable">
    <thead>
      <tr>
   
      <th>ID</th>
     
        <th>Events_1</th>
        
       <th>Rs.</th>
     
         <th colspan="2">operations</th>
      
      </tr>
    </thead>



      <tbody>
      <tr>
      
      <?php
      $a =5;
      while ( $result =mysqli_fetch_assoc($data)) {
        echo "<tbody>

      <tr>   
            <td>".$result['id']."</td>
          
          <td>".$result['eqi2']."</td>
          
           <td>".$result['rs']."</td>
           <td><a href='wedding_eqi2_update.php? id=$result[id]& e2=$result[eqi2]& r=$result[rs] 'class='btn btn-warning'>Update<a>
          <a href='wedding_eqi2_display.php? id=$result[id]'><font color='blue'class='btn btn-danger'>Delete</a></td>
          
          </tr>
       

    </tbody>";
      }
      
     
     
?>

</table>


</div>

<br>


<script type="text/javascript">
  function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[0];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>

<?php
  }
  else{
    echo "<script>
   alert('You have to  login first...!');
   window.location.href='event2.php';
   </script>";
  }
  
?>
</body>
</html><?php
 $conn = new mysqli("localhost","root","","event");
 $id= $_GET['id'];
 $query ="DELETE FROM eqi2 WHERE id='".$id."'";
 $data=mysqli_query($conn,$query);

 


?>