-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
34 lines (33 loc) · 916 Bytes
/
index.php
File metadata and controls
34 lines (33 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require 'db.php';
// Fetch tasks
$stmt = $pdo->query("SELECT * FROM tasks ORDER BY id DESC");
$tasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<title>Task Manager</title>
</head>
<body>
<h1>Task Manager</h1>
<a href="add.php">Add Task</a>
<table border="1" cellpadding="10" cellspacing="0">
<tr>
<th>ID</th>
<th>Task</th>
<th>Actions</th>
</tr>
<?php foreach ($tasks as $task): ?>
<tr>
<td><?= htmlspecialchars($task['id']) ?></td>
<td><?= htmlspecialchars($task['title']) ?></td>
<td>
<a href="edit.php?id=<?= $task['id'] ?>">Edit</a> |
<a href="delete.php?id=<?= $task['id'] ?>" onclick="return confirm('Delete this task?')">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>