该怎么清空$_POST里的数据
时间:2021-07-01 10:21:17
帮助过:4人阅读
该如何清空$_POST里的数据?
试写了一个登陆界面,还没有完成,测试的时候发现问题。$_POST里的值不会清空,每输入一次用户名,$_POST里面就多一个用户名,后果就是第一次错误输入的话,就无法再正确输入用户名。。。除非浏览器刷新页面。。。
Welcome back
Welcome back |
|
Log in:
|
require_once 'connectDB.php';
print '';
if($_SERVER['REQUEST_METHOD']=='POST')
{
$problem = false;
$login = false;
if(empty($_POST['user_name']))
{
$problem = true;
print '
Please enter your user name!
';
}
if(empty($_POST['password']))
{
$problem = true;
print '
Please enter a password
';
}
if(!$problem)
{
$user = trim(stripslashes($_POST['user_name']));
$pwd = trim(stripslashes($_POST['password']));
$user = mysql_real_escape_string($user);
$pwd = mysql_real_escape_string($pwd);
$q = "SELECT * FROM USER WHERE USER_NAME = '$user' and PASSWORD = '$pwd'";