Most PHP developers will check to see if a page request method is ‘POST’ by checking to see if an input exists by isset() function and if the value of that input is null or not. While this works a better method of checking the method is:
// you can check: 'GET', 'HEAD', 'POST', 'PUT' if ($_SERVER['REQUEST_METHOD'] == 'POST') { //do something }
This requires less overhead, is a bit more elegant and more reliable.
Tags: PHP
