How to check whether a request is GET or POST in PHP?

To determine whether the request arrive via GET or POST method use the following code.

PHP Code:

if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    // .... Code for GET Request
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // .... Code for POST Request
}

Comments

Popular posts from this blog

About 12 Alwars

Post thumbnails from external URLs don’t appear in Blogger. How to resolve?