Home > Backend Development > PHP Tutorial > 该怎么清空$_POST里的数据

该怎么清空$_POST里的数据

WBOY
Release: 2016-06-13 12:48:10
Original
1269 people have browsed it

该如何清空$_POST里的数据?
试写了一个登陆界面,还没有完成,测试的时候发现问题。$_POST里的值不会清空,每输入一次用户名,$_POST里面就多一个用户名,后果就是第一次错误输入的话,就无法再正确输入用户名。。。除非浏览器刷新页面。。。

<br>
<br>
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br>
<br>
<br>
<br>
<meta><br>
<meta><br>
<title>Welcome back</title><br>
<style><br />
.auto-style2 {<br />
	text-align: center;<br />
}<br />
.auto-style1 {<br />
	font-size: 36pt;<br />
	text-align: left;<br />
}<br />
.auto-style4 {<br />
	font-family: Broadway;<br />
	font-size: xx-large;<br />
}<br />
</style><br>
<br>
<br>
<br>
<br>
Copy after login











Welcome back
 该怎么清空$_POST里的数据




Log in:

















User Name:

if(isset($_POST['user_name']))
{
print htmlspecialchars($_POST['user_name']);
}
?>
"/>
Password:











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'";
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template