title: Php script not executed on Apache server
body: <p>I have this login system. Forms shows up but direct straight to index.php when login pressed with wrong credentials. No error message... nothing. Does anyone know why this is happening?</p>
  
  <p>Heres my code: </p>
  
  <pre><code>&lt;?php
  session_start();
  
  if(isset($_POST['login'])) {
      include_once("db.php");
      $username = strip_tags($_POST['username']);
      $password = strip_tags($_POST['password']);
  
      $username = stripslashes($username);
      $password = stripslashes($password);
  
      $username = mysqli_real_escape_string($db, $username);
      $password = mysqli_real_escape_string($db, $password);
  
      $password = md5($password);
  
      $sql = "SELECT * FROM users WHERE username='$username' LIMIT 1";
      $query = mysqli_query($db, $sql);
      $row = mysqli_fetch_array($query);
      $id = $row['id'];
      $db_password = $row['password'];
  
      if($password == $db_password) {
          $_SESSION['username'] = $username;
          $_SESSION['id'] = $id;
          header("Location: index.php");
      } else {
          echo "You didn't enter the correct details!";
      }
  
  }
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1 style="font-family:         Tahoma;"&gt;Login&lt;/h1&gt;
  &lt;form action="index.php" method="post" enctype="multipart/form-data"&gt;
      &lt;input placeholder="Username" name="username" type="text" autofocus&gt;
      &lt;input placeholder="Password" name="password" type="password"&gt;
      &lt;input name="login" type="submit" value="Login"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>