title: PHP - Header Location - redirect success login to member.php
body: <p>I tried entering the header location as shown below but it does not redirect when the user successfully logs in. I have had success using this function when accessing the member.php page using the URL and it worked perfectly, redirected the user to the log in page.</p>
  
  <p>I would like to know if there is something wrong with the code I have. Please do your part and guide me if ya can :) thank you!</p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  $username = $_POST['username'];
  $password = $_POST['password'];
  
  if ($username&amp;&amp;$password)
  
  {
  
  $connect = mysql_connect("", "", "") or die ("Couldn't connect!");
  mysql_select_db("") or die("Couldn't find db");
  
  $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  
  $numrows = mysql_num_rows($query);
  
  
  }
  
  ?&gt;
  
  
  
  &lt;link rel="stylesheet" type="text/css" href="stylesheet.css"&gt;
  &lt;html&gt;
  
  &lt;div class="container"&gt;
      &lt;div class="form_wrapper"&gt;
  
          &lt;form action='login.php' method='POST'&gt;
              &lt;?php if ($numrows!=0)
  {
      while ($row = mysql_fetch_assoc($query))
      {
          $dbusername = $row ['username'];
          $dbpassword = $row ['password'];
      }
      // check to see if they match!
      if ($username==$dbusername&amp;&amp;$password==$dbpassword)
      {
          $_SESSION['username']=$username;
          header ("Location: member.php");
          exit();
      }
      else
          echo "Incorrect password!";
  }
  else
      die("User does not exist!");
  ?&gt;
  &lt;br&gt;&lt;br&gt;
              &lt;input type='text' name='username' placeholder="Username"&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type='password' name='password' placeholder="Password"&gt;&lt;br&gt;&lt;br&gt;
              &lt;input type='submit' value='Log In'&gt;
  
          &lt;/form&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/html&gt;
  </code></pre>