title: PHP Cookies not working
body: <p>I am building a website with logins. I have sessions working fine but I need to be able to keep them logged in if the click remember me. Currently I have the login script saving a cookie with the Username and Password they type to some cookies. I the below script $username and $password are set higher in the script. The $_SESSION variables are getting set fine. And I know the script is going into the if statement because before I place a alert box in there.</p>
  
  <p>login.php</p>
  
  <pre><code>while($row = mysql_fetch_array($getLoginResults))
  {
      $error = "Login Successful";
      $_SESSION['Username'] = $_POST['username'];
      $_SESSION['Password'] = $_POST['password'];
      if($keep == 1)
      {
          setcookie("Username", $username, time()+3600*24*30);
          setcookie("Password", $password, time()+3600*24*30);
      }
  }
  </code></pre>
  
  <p>When I check the login, I have a javascript alert so I knoe the cookie is set but the alert box is coming up empty.</p>
  
  <p>check_login.php</p>
  
  <pre><code>echo "&lt;script&gt;alert('".$_COOKIE['Username']."')&lt;/script&gt;";
  </code></pre>
  
  <p>What am I missing???</p>