title: Page refresh after login?
body: <p>I am trying to get my page to refresh after login this is the format of my index.php</p>
  
  <pre><code>&lt;?php
  if(!empty($_SESSION['LoggedIn']) &amp;&amp; !empty($_SESSION['Username']))
  {
      // let the user access the main page  
      // i have made the main content with jquery mobile framework 
  }
  elseif(!empty($_POST['username']) &amp;&amp; !empty($_POST['password']))
  {
      // let the user login
         include "login.php";
  
  }
  else
  {
      // display the login form
  &lt;form method="post" action="index.php" name="loginform" id="loginform"&gt;
              &lt;fieldset&gt;
                  &lt;label for="username"&gt;Username:&lt;/label&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;br /&gt;
                  &lt;label for="password"&gt;Password:&lt;/label&gt;&lt;input type="password" name="password" id="password" /&gt;&lt;br /&gt;
                  &lt;input type="submit" name="login" id="login" value="Login" /&gt;
              &lt;/fieldset&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>Inside my login.php </p>
  
  <pre><code>&lt;?php
  
      $username = mysql_real_escape_string($_POST['username']);
      $password = mysql_real_escape_string($_POST['password']);
  
      $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'");
  
      if(mysql_num_rows($checklogin) == 1)
      {
          $row = mysql_fetch_array($checklogin);
          $email = $row['email'];
          $uid = $row['u_id'];
  
          $_SESSION['Username'] = $username;
          $_SESSION['EmailAddress'] = $email;
          $_SESSION['LoggedIn'] = 1;
          $_SESSION['uid'] = $uid;
          $flag=1;
  
      header("Location: http://5aday.dihops.net/index.php");
  //        echo "&lt;meta http-equiv=\"refresh\" content=\"0;index.php\"&gt;";
  //header("Refresh: 2; url=http://5aday.dihops.net/index.php");
      // THIS IS WHERE I AM STUCK 
        }
      else
      {
          echo "&lt;h1&gt;Error&lt;/h1&gt;";
          echo "&lt;p&gt;Sorry, your account could not be found. Please &lt;a href=\"index.php\"&gt;click here to try again&lt;/a&gt;.&lt;/p&gt;";
      }
  ?&gt;
      }
      ?&gt;
  </code></pre>
  
  <p>I dont know what I am doing wrong. But once the user gives his username and password and submits it .... I get a blank page. and the user has to manually refresh the webpage to see the content of the webpage. </p>