Guest User

Untitled

a guest
Jun 21st, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.02 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['save'])){
  4.     $checkbox = $_POST['check'];
  5.     for($i=0;$i<count($checkbox);$i++){
  6.     $del_id = $checkbox[$i];
  7.     mysqli_query($link,"DELETE FROM admin WHERE id='".$del_id."'");
  8.    
  9.     $message = "Data deleted successfully !";
  10. }
  11. }
  12.  
  13. $result = mysqli_query($link,"SELECT * FROM admin LIMIT $offset,$total_records_per_page");
  14. ?>
  15. <!DOCTYPE html>
  16. <html>
  17. <head>
  18. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  19. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  20.  
  21.  
  22. <style><?php include 'Backend.css'; ?></style>
  23.  
  24.     <meta charset="UTF-8">
  25.     <title>Dashboard</title>
  26.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
  27.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  28.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  29.     <script src='https://kit.fontawesome.com/a076d05399.js'></script>
  30.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  31.  
  32. </head>
  33. <body>
  34.  
  35.  
  36.  
  37. <div><?php if(isset($message)) { echo $message; } ?>
  38. </div>
  39. <div class="container">
  40.  
  41. <form method="post" action="admin.php">
  42. <table class="table table-bordered" id="myTables">
  43. <thead>
  44. <tr>
  45.     <th><input type="checkbox" id="checkAl"> Select All</th>
  46.     <th>Admin Id</th>
  47.     <th>Username</th>
  48.     <th>Email</th>
  49.     <th>Password</th>
  50.     <th>Action</th>
  51. </tr>
  52. </thead>
  53. <?php
  54. $i=0;
  55. while($row = mysqli_fetch_array($result)) {
  56. ?>
  57. <tr>
  58.     <td><input type="checkbox" id="checkItem" name="check[]" value="<?php echo $row["id"]; ?>"></td>
  59.     <td><?php echo $row["id"]; ?></td>
  60.  
  61.     <td><?php echo $row["username"]; ?></td>
  62.     <td><?php echo $row["email"]; ?></td>
  63.     <td><?php echo $row["password"]; ?></td>
  64. <?Php
  65.                                             echo "<td>";
  66.  
  67.     echo "<a href='Admin-View.php?id=". $row['id'] ."' title='View Record' data-toggle='tooltip'><span class='glyphicon glyphicon-eye-open'></span></a>";
  68.                                             echo "<a href='Admin-Update.php?id=". $row['id'] ."' title='Update Record' data-toggle='tooltip'><span class='glyphicon glyphicon-pencil'></span></a>";
  69.                                             echo "<a href='Admin-Delete.php?id=". $row['id'] ."' title='Delete Record' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
  70.  
  71.                                           echo "</td>";
  72.                                           ?>
  73.  
  74.  
  75. </tr>
  76. </div>
  77.             </div>        
  78.         </div>
  79.     </div>
  80.     </div>
  81.  
  82. <?php
  83. $i++;
  84. }
  85. ?>
  86. </table>
  87.  <input type="submit" name="submit" value="Delete" class="btn btn-primary btn-md pull-left" onClick="return confirm('Are you sure you want to delete?');" ></td>
  88. </form>
  89.  
  90.  
  91. <script>
  92. $("#checkAl").click(function () {
  93. $('input:checkbox').not(this).prop('checked', this.checked);
  94. });
  95.  
  96.  
  97. </script>
  98. </body>
  99. </html>
Add Comment
Please, Sign In to add comment