-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewtasks.php
48 lines (39 loc) · 1.12 KB
/
viewtasks.php
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once 'app/connect.php';
$tasksQuery = $db->prepare("
SELECT task_id, task_name
FROM tasks
WHERE user_id = :user_id
");
$tasksQuery->execute([
'user_id' => $_SESSION['user_id']
]);
$tasks = $tasksQuery->rowCount() ? $tasksQuery : [];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>View Tasks</title>
</head>
<body>
<h1>Your Tasks</h1>
<ul>
<?php foreach($tasks as $task): ?>
<li>
<?php echo $task['task_name']; ?>
<a href="app/delete.php?as=delete&task=<?php echo $task['task_id']; ?>">Delete</a>
</li>
<?php endforeach; ?>
</ul>
<form action="app/add.php" method="post">
<input type="text" name="task_name" placeholder="Type a new task here." class="submit" required>
<input type="submit" value="Add" class="submit">
</form>
<form action="index.php">
<input type="submit" value="Home">
</form>
</body>
</html>