Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML&;php按钮自定义显示信息_Php_Html_Button - Fatal编程技术网

HTML&;php按钮自定义显示信息

HTML&;php按钮自定义显示信息,php,html,button,Php,Html,Button,我有一份任务清单 最初,我会显示所有这些。我想创建两个按钮s.t。一个显示按日期排序的任务,另一个显示已通过的任务 我该怎么做?我不知道如何制作一个按钮来做任何事情,除了提交。 我正在考虑重定向到另一个“页面”,但我不确定它是否有效 <button type="button" name = 'display1' value="orderedDisplay">Order by date</button> <button type="button" name = 'di

我有一份任务清单

最初,我会显示所有这些。我想创建两个按钮s.t。一个显示按日期排序的任务,另一个显示已通过的任务

我该怎么做?我不知道如何制作一个按钮来做任何事情,除了提交。 我正在考虑重定向到另一个“页面”,但我不确定它是否有效

<button type="button" name = 'display1' value="orderedDisplay">Order by date</button>
<button type="button" name = 'display2' value="passedTasks">Passed tasks</button>
按日期排序
通过的任务



但我不知道如何“捕捉”使用“按钮”类型按钮单击的事件。

为了让按钮执行某些操作,您需要一些JavaScript,以执行该“操作”:


....
函数callOrderByDate()
{
警告(“我不打算在这里写完整的代码…”);
}
...

只需制作一个标记,当您单击它时,它就会执行您的php脚本显示您已尝试过的内容?看看这个:这也值得一读:。在寻求帮助之前,请尝试做一些研究:)
            <table >
                <tr>
                    <a href="orderedbydate.php">Order by date</a>
                </tr>
                <tr>
                    <a href="pastevents.php">Display past events</a>
                </tr>
            </table>
<input type="button" name='display1' 
       onclick="callOrderByDate()" value="Order by date"/>


....
<script type="text/javascript">
   function callOrderByDate()
   {
        alert("I'm not ging to write the entire code here...");
   }
 ...
 </script>