Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. `<?php
  2. $url='localhost';
  3. $username='root';
  4. $password='';
  5. $conn=mysqli_connect($url,$username,$password,"registerdb");
  6. if(!$conn){
  7. die('Could not Connect My Sql:' .mysql_error());
  8. }
  9.  
  10.  
  11. if(isset($_POST['save'])){
  12. $checkbox = $_POST['check'];
  13. for($i=0;$i<count($checkbox);$i++){
  14. $del_id = $checkbox[$i];
  15. mysqli_query($conn,"DELETE FROM tblentries WHERE id='".$del_id."'");
  16.  
  17. $message = "Entry Deleted Successfully !";
  18. }
  19. }
  20. $result = mysqli_query($conn,"SELECT * FROM tblentries WHERE raceid='" . $_GET['a'] . "'");
  21. ?>
  22. <!DOCTYPE html>
  23. <html>
  24. <head>
  25. <title>View / Delete Entries</title>
  26. <meta charset="utf-8" />
  27. <meta name="viewport" content="width=device-width" />
  28. <style>
  29. #topleftr {
  30. position: absolute;
  31. top: 1%;
  32. left: 12%;
  33.  
  34. }
  35. #topleft {
  36. position: absolute;
  37. top: 12%;
  38. left: 28%;
  39. color:red
  40. }
  41. html, body {
  42. width: 100%;
  43. }
  44. table {
  45. margin: 0 auto;
  46. }
  47. * {
  48. box-sizing: border-box;
  49. }
  50.  
  51. #myInput {
  52. background-image: url('images/search.png');
  53. background-position: 20px 10px;
  54. background-repeat: no-repeat;
  55. width: 20%;
  56. font-size: 16px;
  57. padding: 5px 20px 5px 40px;
  58. border: 1px solid #ddd;
  59. margin-bottom: 5px;
  60. margin-left: 80px;
  61. }
  62.  
  63. #myTable {
  64. border-collapse: collapse;
  65. width: 90%;
  66. border: 1px solid #ddd;
  67. font-size: 18px;
  68. }
  69.  
  70. #myTable th, #myTable td {
  71. text-align: left;
  72. padding: 12px;
  73. }
  74.  
  75. #myTable tr {
  76. border-bottom: 1px solid #ddd;
  77. }
  78.  
  79. #myTable tr.header, #myTable tr:hover {
  80. background-color: #f1f1f1;
  81. }
  82.  
  83.  
  84. </style>
  85.  
  86. <input type="button" id="topleftr" onclick="location.href='indexselectr.php';" value="Return" style="cursor:pointer;font-size:10pt;color:white;background-color:#A9A9A9;border:1px solid #336600;padding:1px";/>
  87.  
  88. </head>
  89. <body>
  90. <u><h3 align="center">Check Race Payment Status & Delete Entries</h3></u>
  91.  
  92. <div style="color:red";><center><?php if(isset($message)) { echo $message; } ?>
  93. </center></div>
  94. <form method="post" action="">
  95. <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for Person.." title="Type in a name or ID No or reference no">
  96. <table id="myTable" class="table table-bordered">
  97. <thead>
  98. <tr>
  99. <th><input type="checkbox" id="checkAl"> Select All</th>
  100. <th hidden>Id</th>
  101. <th>Id No</th>
  102. <th>Surname</th>
  103. <th>Firstname</th>
  104. <th>Distance</th>
  105. <th>Transact No</th>
  106. <th>Reference No</th>
  107. <th>Paid Date</th>
  108. <th>Total Fees</th>
  109. <th>Amount Pd</th>
  110. </tr>
  111. </thead>
  112. <?php
  113. $i=0;
  114. while($row = mysqli_fetch_array($result)) {
  115. ?>
  116. <tr>
  117. <td><input type="checkbox" id="checkItem" name="check[]" value="<?php echo $row["id"]; ?>"></td>
  118. <td hidden><?php echo $row["id"]; ?></td>
  119. <td><?php echo $row["idno"]; ?></td>
  120. <td><?php echo $row["surname"]; ?></td>
  121. <td><?php echo $row["firstname"]; ?></td>
  122. <td><?php echo $row["distance"]; ?></td>
  123. <td><?php echo $row["transno"]; ?></td>
  124. <td><?php echo $row["reference"]; ?></td>
  125. <td><?php echo $row["process"]; ?></td>
  126. <td><?php echo $row["total_fee"]; ?></td>
  127. <td><?php echo $row["amountpaid"]; ?></td>
  128. </tr>
  129. <?php
  130. $i++;
  131. }
  132. ?>
  133. </table>
  134. <p align="center"><button id="topleft";type="submit" class="btn btn-success" name="save">Delete Selected Entries</button></p>
  135. </form>
  136. <script>
  137. $("#checkAl").click(function () {
  138. $('input:checkbox').not(this).prop('checked', this.checked);
  139. });
  140. </script>
  141. <script>
  142. function myFunction() {
  143. var input, filter, table, tr, td, i;
  144. input = document.getElementById("myInput");
  145. filter = input.value.toUpperCase();
  146. table = document.getElementById("myTable");
  147. tr = table.getElementsByTagName("tr");
  148. for (i = 0; i < tr.length; i++) {
  149. td = tr[i].getElementsByTagName("td")[0];
  150. if (td) {
  151. if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
  152. tr[i].style.display = "";
  153. } else {
  154. tr[i].style.display = "none";
  155. }
  156. }
  157. }
  158. }
  159. </script>
  160.  
  161.  
  162. </body>
  163. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement