Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `<?php
- $url='localhost';
- $username='root';
- $password='';
- $conn=mysqli_connect($url,$username,$password,"registerdb");
- if(!$conn){
- die('Could not Connect My Sql:' .mysql_error());
- }
- if(isset($_POST['save'])){
- $checkbox = $_POST['check'];
- for($i=0;$i<count($checkbox);$i++){
- $del_id = $checkbox[$i];
- mysqli_query($conn,"DELETE FROM tblentries WHERE id='".$del_id."'");
- $message = "Entry Deleted Successfully !";
- }
- }
- $result = mysqli_query($conn,"SELECT * FROM tblentries WHERE raceid='" . $_GET['a'] . "'");
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>View / Delete Entries</title>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width" />
- <style>
- #topleftr {
- position: absolute;
- top: 1%;
- left: 12%;
- }
- #topleft {
- position: absolute;
- top: 12%;
- left: 28%;
- color:red
- }
- html, body {
- width: 100%;
- }
- table {
- margin: 0 auto;
- }
- * {
- box-sizing: border-box;
- }
- #myInput {
- background-image: url('images/search.png');
- background-position: 20px 10px;
- background-repeat: no-repeat;
- width: 20%;
- font-size: 16px;
- padding: 5px 20px 5px 40px;
- border: 1px solid #ddd;
- margin-bottom: 5px;
- margin-left: 80px;
- }
- #myTable {
- border-collapse: collapse;
- width: 90%;
- border: 1px solid #ddd;
- font-size: 18px;
- }
- #myTable th, #myTable td {
- text-align: left;
- padding: 12px;
- }
- #myTable tr {
- border-bottom: 1px solid #ddd;
- }
- #myTable tr.header, #myTable tr:hover {
- background-color: #f1f1f1;
- }
- </style>
- <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";/>
- </head>
- <body>
- <u><h3 align="center">Check Race Payment Status & Delete Entries</h3></u>
- <div style="color:red";><center><?php if(isset($message)) { echo $message; } ?>
- </center></div>
- <form method="post" action="">
- <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for Person.." title="Type in a name or ID No or reference no">
- <table id="myTable" class="table table-bordered">
- <thead>
- <tr>
- <th><input type="checkbox" id="checkAl"> Select All</th>
- <th hidden>Id</th>
- <th>Id No</th>
- <th>Surname</th>
- <th>Firstname</th>
- <th>Distance</th>
- <th>Transact No</th>
- <th>Reference No</th>
- <th>Paid Date</th>
- <th>Total Fees</th>
- <th>Amount Pd</th>
- </tr>
- </thead>
- <?php
- $i=0;
- while($row = mysqli_fetch_array($result)) {
- ?>
- <tr>
- <td><input type="checkbox" id="checkItem" name="check[]" value="<?php echo $row["id"]; ?>"></td>
- <td hidden><?php echo $row["id"]; ?></td>
- <td><?php echo $row["idno"]; ?></td>
- <td><?php echo $row["surname"]; ?></td>
- <td><?php echo $row["firstname"]; ?></td>
- <td><?php echo $row["distance"]; ?></td>
- <td><?php echo $row["transno"]; ?></td>
- <td><?php echo $row["reference"]; ?></td>
- <td><?php echo $row["process"]; ?></td>
- <td><?php echo $row["total_fee"]; ?></td>
- <td><?php echo $row["amountpaid"]; ?></td>
- </tr>
- <?php
- $i++;
- }
- ?>
- </table>
- <p align="center"><button id="topleft";type="submit" class="btn btn-success" name="save">Delete Selected Entries</button></p>
- </form>
- <script>
- $("#checkAl").click(function () {
- $('input:checkbox').not(this).prop('checked', this.checked);
- });
- </script>
- <script>
- function myFunction() {
- var input, filter, table, tr, td, i;
- 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) {
- if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
- tr[i].style.display = "";
- } else {
- tr[i].style.display = "none";
- }
- }
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement