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