How do I clear the data in $ _ POST? I tried to write a login interface, which was not completed yet. I found the problem during the test. The values in $ _ POST are not cleared. each time you enter a user name, there is one more user name in $ _ POST. The consequence is that the user name cannot be entered correctly after the first error is entered... Unless the browser refreshes the page... & Lt ;! How does DOCTYPE & nbsp clear the data in $ _ POST?
I tried to write a login interface, which was not completed yet. I found the problem during the test. The values in $ _ POST are not cleared. each time you enter a user name, there is one more user name in $ _ POST. The consequence is that the user name cannot be entered correctly after the first error is entered... Unless the browser refreshes the page...
Welcome back
.auto-style2 {
text-align: center;
}
.auto-style1 {
font-size: 36pt;
text-align: left;
}
.auto-style4 {
font-family: Broadway;
font-size: xx-large;
}
Welcome back
Log in:
require_once 'connectDB.php';
print '
.error {color: red;}';
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'";