-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo.php
56 lines (47 loc) · 1.14 KB
/
todo.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
49
50
51
52
53
54
55
56
<?php
include 'includes/passwords.inc';
include 'includes/settings.inc';
include 'includes/header.inc';
include 'includes/sendmail.inc';
$connection = new PDO('mysql:host=localhost;dbname=todo_list', user, pass);
if (isset($_POST["Name"])) {
if (strcmp($_POST["Name"],"") != 0) {
$connection->exec("INSERT INTO entries (Name, Done) VALUES ('".$_POST["Name"]."', '0')");
}
}
DrawHeaderAndFooter::drawHeader("Todo-Liste");
?>
<header>
<h1>Todo - Liste</h1>
</header>
<span style="font-weight:bold;">Zu erledigen:</span>
<br />
<?php
$retrieveList = "SELECT * FROM entries";
foreach ($connection->query($retrieveList) as $row) {
if ($row["Done"] == 0) {
echo ". ".$row['Name'];
echo "<br />";
}
}
?>
<br /><br />
<span style="font-weight:bold;">Erledigt:</span>
<br />
<?php
$retrieveList = "SELECT * FROM entries";
foreach ($connection->query($retrieveList) as $row) {
if ($row["Done"] == 1) {
echo ". ".$row['Name'];
echo "<br />";
}
}
?>
<br /><br />
<form action="#" method="post">
<input name="Name" type="text">
<input type="submit" value="Erfassen">
</form>
<?php
DrawHeaderAndFooter::drawFooter();
?>