title: Button type submit not sending data to the server
body: <p>I'm new to PHP. I'm making a login form.
  Here's my html:</p>
  
  <pre><code>&lt;form method="POST" id="login_form" action="log_in.php"&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="Username"&gt;Username&lt;/label&gt;
          &lt;input autocomplete="off" type="text" class="form-control" id="username" required&gt;
  
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="Password"&gt;Password&lt;/label&gt;
          &lt;input autocomplete="off" type="password" class="form-control" id="password" required&gt;
      &lt;/div&gt;
      &lt;button type="submit" id="submit_login" class="btn"&gt;Log in&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here's my log_in.php</p>
  
  <pre><code>&lt;?php
  include("db.php");
  
  
  if ($_SERVER['REQUEST_METHOD']=='POST') {
      $username = $_POST["username"];
      $password = $_POST["password"];
      $stmt = $conn-&gt;prepare("SELECT * FROM users WHERE username=? AND pass=?");
      $stmt-&gt;bind_param("ss", $username, $password);
      $stmt-&gt;execute();
      $result = $stmt-&gt;get_result();
      $check = mysqli_num_rows($result);
      if ($check &gt; 0) {
          while ($row = $result-&gt;fetch_assoc()) {
              if ($username == $row['username'] &amp;&amp; (password_verify($password, $row['pass']) || $password == $row['pass'])) {
                  if ($row['stat'] == "Admin") {
                      $conn-&gt;close();
                      header("Location: admin.php");
                      break;
                  } else {
                      $conn-&gt;close();
                      header("Location: member.php");
                      break;
                  }
              }
          }
      }
  }
  else {
      echo "&lt;script&gt;";
      echo "alert('No Matching Records!');";
      echo "&lt;/script&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>The problem is that I think the button does not submit the username and password to the server. i get an error Undefined index:username, and Undefined index:password. and it does not log in and load to the header destination. i cant find the problem. thank u in advance!</p>