Advertisement
faizulclass

task_list.php

Nov 8th, 2024 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.10 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>Task List</title>
  7.     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  8.     <link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">
  9.     <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  10.     <script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
  11. </head>
  12. <body>
  13. <?php
  14.  
  15. // Include header
  16. include('header.php');
  17. ?>
  18.     <div class="container">
  19.         <div class="row">
  20.             <!-- Include Left Navigation -->
  21.             <?php include('nav.php'); ?>
  22.  
  23.             <!-- Main Content Section -->
  24.             <div class="col-md-9">
  25.                 <h2>Task List</h2>
  26.                 <div class="mb-3 text-right">
  27.                     <a href="add_task.php" class="btn btn-success">Add Task</a>
  28.                 </div>
  29.  
  30.                 <table id="taskTable" class="table table-striped">
  31.                     <thead>
  32.                         <tr>
  33.                             <th>Task Name</th>
  34.                             <th>Description</th>
  35.                             <th>Due Date</th>
  36.                             <th>Created At</th>
  37.                             <th>Actions</th>
  38.                         </tr>
  39.                     </thead>
  40.                     <tbody>
  41.                         <?php if ($result && mysqli_num_rows($result) > 0): ?>
  42.                             <?php while ($task = mysqli_fetch_assoc($result)): ?>
  43.                                 <tr>
  44.                                     <td><?php echo htmlspecialchars($task['task_name']); ?></td>
  45.                                     <td><?php echo htmlspecialchars($task['task_description']); ?></td>
  46.                                     <td><?php echo htmlspecialchars($task['due_date']); ?></td>
  47.                                     <td><?php echo htmlspecialchars($task['created_at']); ?></td>
  48.                                     <td>
  49.                                         <a href="edit_task.php?task_id=<?php echo $task['task_id']; ?>" class="btn btn-warning btn-sm">Update</a>
  50.                                         <a href="delete_task.php?task_id=<?php echo $task['task_id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this task?');">Delete</a>
  51.                                     </td>
  52.                                 </tr>
  53.                             <?php endwhile; ?>
  54.                         <?php else: ?>
  55.                             <tr>
  56.                                 <td colspan="5" class="text-center">No tasks found.</td>
  57.                             </tr>
  58.                         <?php endif; ?>
  59.                     </tbody>
  60.                 </table>
  61.             </div>
  62.         </div>
  63.     </div>
  64.     <?php
  65. // Include footer
  66. include('footer.php');
  67. ?>
  68.  
  69.     <script>
  70.         $(document).ready(function() {
  71.             $('#taskTable').DataTable();
  72.         });
  73.     </script>
  74. </body>
  75. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement