<?php
 include("../conn.php");
 $page='Edit room';
 if (isset($_GET['id'])) {
 $id=mysqli_real_escape_string($conn, $_GET['id']);
 $id2=base64_decode($id); }


      $query = "SELECT * FROM rooms WHERE id= '$id2'";  
      $result = mysqli_query($conn, $query);  
      while ($row=mysqli_fetch_array($result)) {
          $number=$row['number'];
         

   


 }  




   ?>
 <?php include("../common/head.php");?>
<div class="activate-itme text-center m-5">
     <p class="activate"> Are you sure you want to delete room <?php echo $number?> </p>
     <form method="post">
        <input type="hidden" name="id" value="<?php echo $data?>">
        <button name="submit" class=" btn btn-danger btn-sm m-2">Yes</button>
        <a href="../room" class=" btn btn-success btn-sm m-2">No</a>
    </form>
     </div>










     <?php
    
     

     if(isset($_POST['submit'])){

		
      $id=$_POST['id'];
     
    
    
      $sql= "DELETE FROM  `rooms` WHERE id='$id2'";
      $query_run = mysqli_query($conn, $sql);
          
          
      if($query_run){
        echo"<script>alert('Room Deleted'); window.location='../room'</script>";
      }
      else{
        echo 'Error: '.mysqli_error($conn);
      }
    
      }
 
       ?>