简体   繁体   English

PHP中的待办事项列表

[英]Todo list in php

I'm building a simple todo list application in PHP.I am displaying the titles of all the todo list on one page via ajax using the following code 我正在用PHP构建一个简单的待办事项列表应用程序,使用以下代码通过ajax在一页上显示所有待办事项列表的标题

 $sql2 = mysql_query("SELECT id, todo FROM todo");

while($row = mysql_fetch_array($sql2))
{
$todo1 = $row["todo"];
$todofeed.='

<ul>
    <li>' . $todo1 . '</li>
</ul>   

';
  }
  print "$todofeed";

Now i want to create an interface in such a way that the user clicks on one todo list title and all items in that list are displayed via some jQuery effect...any way around this?? 现在,我想创建一个界面,使用户单击一个待办事项列表标题,并且该列表中的所有项目都通过某种jQuery效果显示出来...可以通过任何方式解决? i jus need a direction...thanks :) 我需要一个方向...谢谢:)

这是一个很好的教程,介绍了如何使用PHP和JQuery创建待办事项应用程序: 使用PHP,MySQL和jQuery进行AJAX编辑的待办事项列表

Fetch all the items of that todo list in a div with display:none . 使用display:none在div中获取该待办事项列表的所有项目。 Then , use Jquery .click to change its display attribute to visible. 然后,使用Jquery .click将其显示属性更改为visible。

<script>
$("#todolist_title").click(function() {
  $("#todolist_items").css('display' , 'visible');
});
</script>

<div id='todolist_title'>Title</div>
<br />
<div id='todolist_items' style='display:none'>
1.Item1<br />
2.Item2<br />
3.Item3<br />
</div>

Please add this code on page where you want to populate todofeeds 请在您要填充待办事项的页面上添加此代码

<script type="text/javascript">
function todolist() {
$('#todolist').load("PHP Page Path Where you execute Query").slideDown();   
}
</script>

<div id="todolist" style="display:none"></div>

Please include Database connection on PHP page. 请在PHP页面上包括数据库连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM