我是Php世界的新手。这是我第一个以任何形式提出的问题。请告诉我我的页面中有什么错误。当我提交表格时,没有结果。请给我任何解决办法。
我试着跟踪这视频。
<!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>发布于 2015-12-27 08:48:35
PHP中的变量区分大小写。。在您的示例中,将$_post更改为$_POST似乎具有所需的结果,$_POST是在脚本执行时存储POST数据的地方。
您还需要确保脚本的名称实际上是index.php,因为表单将将POST数据发送到那里。
https://stackoverflow.com/questions/34478874
复制相似问题