admin管理员组

文章数量:1208155

When the form is submitted it keeps returning a GET method when I want a POST.

I dont understand where the problem is, any help would be much appreciated.

Code below:

Form in login.php:

 <form action="includes/login.inc.php" method="post">
      <button>Login</button>
 </form>

includes/login.inc.php:

<?php
            
// This is printing - Request Method: GET 
echo "Request Method: " . $_SERVER["REQUEST_METHOD"] . "<br>";

if ($_SERVER["REQUEST_METHOD"] === "POST") {
  echo "Form submitted successfully";
} else {
  // This is printing - Request Method: GET 
  echo "Request Method: " . $_SERVER["REQUEST_METHOD"] . "<br>";
}

本文标签: Form POST method responding as GET in php fileStack Overflow