dsa88886666 2016-04-07 18:44
浏览 128

PHP显示用户输入

Im trying to code a super simple to-do list. At the moment I'm stuck at displaying an added task back to the user. I want the tasks to be displayed right under the input form, preferably in an ordered list. Here's what I have so far:

<html>
<head>
      <title>To do list</title>
</head>

<body>

<h3>To do list</h3>

<form action='' method='post'>
    <label>Add task: <input type='text' name='task' value=''/></label>
    <input type='submit' name='submit' value='Add'/>
</form> 

<ol>

<?php
if(isset($_POST['submit'])) {
  echo ($_POST['task']);
}
?>

</ol>

</body>
</html>

Except when I type in the task and click "Add" it looks like nothing happens. I tried these two threads, because they seemed to be what I needed:

Display entered text with echo after input PHP

Simple html/php form to output on the same page

But this didn't help, I even tried just straight copying the code from those threads and the same thing happens. I type in the task, I click "Add" and... nothing. Thanks in advance for help

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数