title: PHP Log In page does not log in after inputting the credentials
body: <p>**So, this is my code for a log in page. The problem I have is that when I click the button to log in I get this outcome which does not help me in any way to see my mistake -  </p>
  
  <p><img src="https://i.stack.imgur.com/V0tok.png" alt="here is a picture"> 
       I do not understand why I get this as an outcome.
     I have a working sign up page which is capable of sending the sign up data to the database where it is stored. When I try to log in with this data though, it does not recognise the data. I checked a few times the code, I am still new to php and can not find the problem.</p>
  
  <p>I hope it is not a stupid question. Thank you in advance!</p>
  
  <p><strong>PHP Log in</strong></p>
  
  <pre><code>  &lt;?php&gt;
          session_start();
  
          $error='';//here we store potential errors
  
          if(isset($_POST['submit'])) {
              if(empty($_POST['username']) || empty($_POST['password'])) {
                  $error = "Username or password invalid";
              }
              else
              {
                  //define the variables
                  $username = $_POST['username'];
                  $password = $_POST['password'];
  
                  //connection
                  $conn= mysqli_connect("host","***","***","***");
  
                  $query = "SELECT * FROM user WHERE username='$username' AND password='$password'";
  
                  $stmt = $conn-&gt;prepare($query);
                  $stmt-&gt;bind_param("ss",$username,$password);
                  $stmt-&gt;execute();
                  $stmt-&gt;bind_result($username,$password);
                  $stmt-&gt;store_result();
  
              if($stmt-&gt;fetch())
              {
                  $_SESSION['username'] = $username;
                   $_SESSION['success'] = "You are now logged in";
                  header("location: index.php");
              }
              else{
                  $error="Username or Password invalid";
              }
              mysqli_close($conn);
          }
      }
  
  
  
  
      ?&gt;
  
  
  ?&gt;
  </code></pre>
  
  <p><strong>Log In form</strong></p>
  
  <pre><code>&lt;?php
  include_once 'header.php';
  ?&gt;
  
  &lt;div class="header"&gt;
      &lt;h2&gt;Login&lt;/h2&gt;
    &lt;/div&gt;
  
    &lt;form method="post" action="Log.php"&gt;
      &lt;?php include('errors.php'); ?&gt;
     &lt;input placeholder="Username" type="text" name="username" &gt;
        &lt;input placeholder="Password" type="password" name="password" &gt;
  
         &lt;input type="submit" name="submit" &gt;
      &lt;p&gt;
          Not yet a member? &lt;a href="register.php"&gt;Sign up&lt;/a&gt;
      &lt;/p&gt;
    &lt;/form&gt;
  
   &lt;?php
  include_once 'footer.php';
  
  ?&gt;
  </code></pre>