0

私は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 />';
     }
  } ?>
4

0 に答える 0