未定义索引php if($ _SERVER ['REQUEST_METHOD'] =='POST'){找不到答案?

    <form class="login" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
    <h4 class="text-center">Admin Login</h4>
    <input class="form-control" type="text" name="user" placeholder="Username" autocomplete="off"/>
    <input class="form-control" type="password" name="pass" placeholder="Password" autocomplete="new-password"/>
    <input class="btn btn-primary btn-block" type="submit"  value="Login">
  </form>

I made form method="POST" on php

if ($_SERVER['REQUEST_METHOD'] == 'POST' ){

  $username =   $_POST['user'];
  $pass =       $_POST['pass'];
  $hashPass =   sha1($pass);

  $stmt = $con->prepare("SELECT Username,Password FROM users WHERE Username = ? AND Password = ?");
  $stmt->execute(array($username,$hashPass));
  $count =$stmt->rowCount();

  echo $count;

but result

Notice: Undefined index: user in C:\xampp\htdocs\eCommerc\admin\index.php on line 7

Notice: Undefined index: pass in C:\xampp\htdocs\eCommerc\admin\index.php on line 8

This problem because the Windows Operation system doesn't Enable some PHP

method to be sure use phpinfo() function will not find REQUEST_METHOD

so change the Operation system or try to use another method