title: What is wrong with my code? I think it may be the header() command
body: <p>When I run the below code, it clears the form and keeps me on the same page. I am wanting it to, on successful login, re-direct to home.php</p>
  <p>I think there is a problem with my</p>
  <pre><code>header()
  </code></pre>
  <p>I've tried various different things here and have also read that the Location must be a http address, if this is the case, how do i make it point to home.php which sits in my root directory. Any ideas? also any other comments on the code would be appreciated.</p>
  <pre><code>&lt;?php include_once(&quot;scripts/global.php&quot;);
  $message='';
  if(isset($_POST['email'])){
      
      $email=$_POST['email'];
      $pass=$_POST['pass'];
      $remember=$_POST['remember'];
      
      // error handling
      
      if( (!$email) || (!$pass)){
          $message = 'Please enter both fields';
      }else{
          
      //secure the data
          $email=mysqli_real_escape_string($link, $email);
          $pass=sha1($pass);
          
          $query=mysqli_query($link, &quot;SELECT * FROM Members WHERE email='{$email}' AND password='{$pass}' LIMIT 1&quot;) or die(mysql_error($link));
          $count_query=mysqli_num_rows($query);
          
          if($count_query == 0){
              $message='The information you entered was incorrect';
          }else{
              // start the sessions
              
              $_SESSION['pass'] = $pass;
              while($row=mysqli_fetch_array($link, $query)){
                  $username=$row['username'];
                  $id=$row['id'];
              }
              $_SESSION['username']=$username;
              $_SESSION['id']=$id;
              
              if($remember == &quot;yes&quot;){
                  // create the cookies
                  setcookie(&quot;id_cookie&quot;, $id, time()+60*60*24*100, &quot;/&quot;);
                  setcookie(&quot;pass_cookie&quot;, $pass, time()+60*60*24*100, &quot;/&quot;);
              }
              
              header('Location: ./home.php');
          }
      }
  }
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;title&gt;Login to Sweet Chain Fantasy 2022&lt;/title&gt;
      &lt;link href=&quot;css/global.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;/&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div class=&quot;container center&quot;&gt;
  &lt;h1&gt;Login to Sweet Chain Fantasy 2022&lt;/h1&gt;
      &lt;p&gt;&lt;?php echo(&quot;$message&quot;); ?&gt;&lt;/p&gt;
  &lt;form action=&quot;login.php&quot; method=&quot;post&quot;&gt;
      &lt;input type=&quot;text&quot; name=&quot;email&quot; placeholder=&quot;Email Address&quot; /&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;input type=&quot;password&quot; name=&quot;pass&quot; placeholder=&quot;Password&quot; /&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;input type=&quot;checkbox&quot; name=&quot;remember&quot; value=&quot;yes&quot; checked=&quot;checked&quot; /&gt;Remember me?&lt;br /&gt;&lt;br /&gt;
      &lt;input type=&quot;submit&quot; name=&quot;Login&quot; /&gt;
      &lt;/form&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>