我无法解决 php 中的基本代码形式

I can't solvebasic code form in php

我是 Php 世界的新人。 这是我以任何形式提出的第一个问题。 请告诉我我的页面中有哪些错误。 当我提交表格时,没有结果出来。 请给我任何解决方案。

我试着关注 this 视频。

<!Doctype html>
<html>
<head>
    <title> My page </title>``
</head>
<body>

    <p style="font-weight:bold">hello1 world</p>
    <?php

    // Restaruant open at 8
    // Restaruant from 8-11
    // Lunch from 11-4
    // closes at 4
    $launch_menu = "Nashta <br /> 
    halwa <br /> gosher <br /> ";

    $breakfast_menu = "Launch <br />
    sugar <br /> meat <br /> ";

    if(isset($_post['time'])) {
        $time = $_post['time'];

        if($time < 8 or $time >= 16 ) {
            echo "sorry, we are closed <br />" ;
        }
        else{
            echo "Hi, what would you like order <br /> ";
            if($time < 11){
                echo $breakfast_menu;
            }
            else if ($time < 16)
            {
                echo $launch_menu;
            }
        }
    }

    ?>
    <form action='index.php' method='post'>
    What time is it? <input type='text' name='time' /> <br />
    <input type='submit' value='Submit'>
    </form>
</body>
</html>

Variables in PHP are case-sensitive. In your example, changing $_post to $_POST seems to have the desired outcome, since the superglobal $_POST 是脚本执行时 POST 数据存储的位置。

您还需要确保脚本的名称实际上是 index.php,因为这是表单将 POST 数据发送到的地方。