title: Checking Login from form then redirecting to another page
body: <p>This was my last attempt that I tried as a last effort:</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
      &lt;head&gt;
          &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;
          &lt;title&gt;Customer Login&lt;/title&gt;
          &lt;link href="stylesheet.css" rel="stylesheet" type="text/css" /&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;div class="wrapper"&gt;
              &lt;div class="login"&gt;
                  &lt;form name="loginForm" action="loginCheck.php" method="post"&gt;
                      &lt;?php require("protect/serverInfo.php"); ?&gt;
                          Email: &lt;input type="text" name="Email" maxlength="35" /&gt;&lt;br /&gt;
                          Password: &lt;input type="text" name="Password" maxlength="4" /&gt;&lt;br /&gt;
                      &lt;input type="submit" name ="submit"/&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>loginCheck.php</p>
  
  <pre><code>&lt;?php
          session_start();
          $_SESSION['email'] = $_POST['Email'];
          $_SESSION['password'] = $_POST['Password'];
          require("protect/serverInfo.php");
          $myusername=$_POST[Email]; 
          $mypassword=$_POST[Password];
          $result = mysql_query("SELECT * FROM Customers WHERE Email='$myusername' AND Password=$mypassword");
          $count=mysql_num_rows($result);
          if($count==1){      
              header('Location: customer.php');
              exit();
          }
          else{
              header('Location: index.php');
              exit();
          }
  ?&gt;
  </code></pre>
  
  <p>customer.php</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
  &lt;meta content="text/html; charset=utf-8" http-equiv="Content-Type" /&gt;
  &lt;title&gt;Untitled 1&lt;/title&gt;
  &lt;link href="stylesheet.css" rel="stylesheet" type="text/css" /&gt;
  &lt;?php
      session_start();
      $myusername = $_SESSION['email']; 
      $mypassword = $_SESSION['password'];
  ?&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;?php
  echo"success";
  ?&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I just need a very simple way to have a form post, the post info to be checked if correct then redirect if correct and pass the post data with it. I have been trying to use sessions and redirects but it doesn't to work quite right. What is the easiest way to accomplish this. At the moment I have been using PHP to check the login info from a MySQL database. </p>