-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodolist_add_item.php
56 lines (42 loc) · 1.25 KB
/
todolist_add_item.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_once 'dbh.inc.php';
include_once 'database.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>My To Do List Creator</title>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<body>
<h1>To Do List Creator</h2>
<?php
$sql = "SELECT * FROM todoitems;";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo "Task " . $row['ItemNum'] . ": " . $row['Title'] . "<br>";
}
} else
echo "There are no items to do yet. Enter an item below and click add item";
?>
<?php
$queryItem = 'SELECT * FROM todoitems
ORDER BY ItemNum';
$statement3 = $db->prepare($queryItem);
$statement3->execute();
$todoitems = $statement3->fetchAll();
$statement3->closeCursor();
?>
<form action="additem.inc.php" method="POST">
<input type="text" name="ItemNum" placeholder="Item Number">
<br>
<input type="text" name="Title" placeholder="Title">
<br>
<input type="text" name="Description" placeholder="Description">
<br>
<button type="Submit" name="submit">Add Item</button>
</form>
</body>
</html>