最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Form POST method responding as GET in php file - Stack Overflow

programmeradmin4浏览0评论

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>";
}
发布评论

评论列表(0)

  1. 暂无评论