-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtasks.php
30 lines (28 loc) · 1.29 KB
/
tasks.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
<?php require_once APPROOT . '/src/views/include/header.php'; ?>
<h1>Test Database</h1>
<h2>This page tests the connection to a database, using a typical "to-do list app" to perform CRUD operations</h2>
<hr>
<h3>[CREATE] Add new task</h3>
<form action="<?= URLROOT; ?>/test/add-task" method="post">
<input type="text" name="new_task" placeholder="Description...">
<input type="submit" value="Add task">
</form>
<h3>[READ] Get all tasks:</h3>
<ul>
<?php foreach($data as $task): ?>
<li>
<?php if ($task->completed): ?>
<strike> <?= $task->description; ?> </strike>  
<?php else : ?>
<?= $task->description; ?>  
<form action="<?= URLROOT; ?>/test/<?= $task->id; ?>/mark-done" method="post">
<input type="submit" value="Mark as done">
</form>
<?php endif; ?>
<form action="<?= URLROOT; ?>/test/<?= $task->id; ?>/delete" method="post">
<input type="submit" value="Delete">
</form>
</li>
<?php endforeach; ?>
</ul>
<?php require_once APPROOT . '/src/views/include/footer.php'; ?>