我正在使用twitter bootstrap,<form action="" method="post">
出于某种原因,充当<form action="" method="get">
有谁知道为什么会这样?我在Windows 7上使用Chrome。
编辑:整个表格是这样的:
<form action="" method="post">
<input type="text" name="username" class="input-block-level" placeholder="Username">
<input type="password" class="input-block-level" name="password" placeholder="Password">
<input class="btn btn-large btn-primary" type="submit" value="Sign in"><span>OR</span> <a class="btn btn-large btn-success" href="#">Sign Up</a>
</form>
PHP:
<?php
if(empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) === true || empty($password) === true) {
$errors[] = 'You need to enter a username and password.';
} else if (user_exists($username) === false) {
$errors[] = 'We can\'t find that username. Have you registered?';
} else if (user_active($username) === false) {
$errors[] = 'You haven\'t activated your account!';
} else if(strlen($password) > 32 ) {
$errors[] = 'Password to long.';
}
$login = login($username, $password);
if($login === false){
$errors[] = 'That username/password combination is incorrect.';
}else{
$_SESSION['user_id'] = $login;
header('Location: index.php');
exit();
}
}
if(empty($errors)===false){
?>
<h1>We tried to log you in, but....</h1>
<?php
foreach($error as $errors){
echo $error . '<br />';
}
} ?>