-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.php
72 lines (49 loc) · 2.07 KB
/
demo.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
62
63
64
65
66
67
68
69
70
71
72
<?php
require "connect.php";
require "todo.class.php";
// Select all the todos, ordered by position:
$query = mysql_query("SELECT * FROM `bf_todo` ORDER BY `position` ASC");
$todos = array();
// Filling the $todos array with new ToDo objects:
while ($row = mysql_fetch_assoc($query)) {
$todos[] = new ToDo($row);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AJAX-ed To Do List With PHP, jQuery & MySQL | Tutorialzine demo</title>
<!-- Including the jQuery UI Human Theme -->
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/themes/humanity/jquery-ui.css" type="text/css" media="all" />
<!-- Our own stylesheet -->
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<h1>AJAX-ed To Do List With PHP, jQuery & MySQL</h1>
<h2><a href="http://tutorialzine.com/2010/03/ajax-todo-list-jquery-php-mysql-css/">Go Back to the Tutorial »</a></h2>
<div id="main">
<ul class="todoList">
<?php
// Looping and outputting the $todos array. The __toString() method
// is used internally to convert the objects to strings:
foreach ($todos as $item) {
echo $item;
}
?>
</ul>
<a id="addButton" class="green-button" href="#">Add a ToDo</a>
</div>
<!-- This div is used as the base for the confirmation jQuery UI POPUP. Hidden by CSS. -->
<div id="dialog-confirm" title="Delete TODO Item?">
Are you sure you want to delete this TODO item?
</div>
<p class="note">
The todos are flushed every hour. You can add only one in 5 seconds.
</p>
<!-- Including our scripts -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</body>
</html>