PHP $_POST 不起作用 [英] PHP $_POST not working

查看:85
本文介绍了PHP $_POST 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习有关 $_POST 的 PHP 教程,它让我创建了一个包含两页的练习.在第一页(表单页面)上,它会创建一个表单,用户可以在其中输入用户名和密码.单击提交后,它会在第二页 (process.php) 上打开,其中应显示用户名和密码,这是使用 $_Post 的结果.但是,当我在第一页上单击提交时,它会将我带到第二页,其中只显示 Echo 语句中的:".没有用户名,没有密码.

I'm following a PHP tutorial which is teaching about $_POST and it had me create an exercise with two pages. On the first page (Form page) it creates a form where a user enters Username and Password. Once they click submit, it opens on the second page (process.php) where the Username and Password should be displayed as a result of using $_Post. However, when I click submit on the first page, it takes me to the second page where only the ":" in the Echo statement is displayed. No username, no password.

有什么想法吗?我已经复制了表单页面和下面的 process.php.

Any ideas? I've copied the form page and the process.php below.

Form page

<html>
<head>
<title>encode</title>
</head>
<body>
<form action="process.php" method="post">
     Username: <input type="text" name="username" value="" />
     <br/>
     Password: <input type="password" name="password" value=""/>
     <br/>
     <input type="submit" name="submit" value="Submit"/>
     </form>
</body>
</html>

进程.php

<html>
<head>
<title>encode</title>
</head>
<body>
 <?php
$username = $_Post['username'];
$password = $_Post['password'];

echo "{$username}: {$password}";
?>

</body>
</html>

推荐答案

尝试使用 $_POST(全部大写).

Try using $_POST (all caps).

函数不区分大小写,但变量不区分.

Functions are case insensitive, but variables aren't.

这篇关于PHP $_POST 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆