-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
61 lines (48 loc) · 2 KB
/
index.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
57
58
59
60
61
<?php
include "includes/connection.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>Saq's To do list app!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="includes/style.css">
</head>
<body>
<h1>Saq's to do list!</h1>
<div class="container tasks">
<ul>
<?php
//display tasks using try catch
try {
$viewsqlstmnt = "SELECT * FROM `todo`";
$result = $conn->query($viewsqlstmnt);
foreach($result as $row ){
echo " <li><div class='row'>
<form action='Updelete.php' method='post'>
<div class='col-xs-10'><input contenteditable='true' name='text' class='output' value='" . $row['task'] . "' /></div>
<div class='col-xs-1'><input type='submit' value='Update' name='Update' class='btn btn-warning update' /></div>
<div class='col-xs-1'><input type='submit' value='Delete' name='Delete' class='btn btn-danger delete' /></div>
<input type='hidden' name='id' value='" . $row['id'] . "' />
</form>
</div></li>";
}
}
catch(PDOException $e) {
echo $e->getMessage();
}
?>
<li><div class='row'>
<form action="add.php" method="post">
<div class='col-xs-10'><input type="text" id="add" placeholder="What do you need to do?" required="required" name="text" /></div>
<div class='col-xs-2'><input type="submit" value="Add" name="Add" class='btn btn-lg btn-default' /></div>
</form>
</div></li>
</ul>
</div> <!-- container class end div -->
</body>
</html>