Check the $_SERVER['REQUEST_METHOD'] when a form is submitted

$_SERVER['REQUEST_METHOD'] = GET

$_POST[] =

array (
)

$_GET[] =

array (
)

$_REQUEST[] =

array (
)

Form with method="get":

Form with method="post":


$_SERVER[] =

array (
  'PATH' => '/usr/local/bin:/bin:/usr/bin',
  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_ACCEPT_ENCODING' => 'br,gzip',
  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
  'HTTP_CONNECTION' => 'Keep-Alive',
  'HTTP_HOST' => 'alpha.w3dx.co.uk',
  'HTTP_USER_AGENT' => 'CCBot/2.0 (https://commoncrawl.org/faq/)',
  'DOCUMENT_ROOT' => '/home/w3dx/@subdomains/alpha/public_html',
  'REMOTE_ADDR' => '3.81.28.10',
  'REMOTE_PORT' => '46838',
  'SERVER_ADDR' => '77.72.4.66',
  'SERVER_NAME' => 'alpha.w3dx.co.uk',
  'SERVER_ADMIN' => 'webmaster@alpha.w3dx.co.uk',
  'SERVER_PORT' => '80',
  'REQUEST_SCHEME' => 'http',
  'REQUEST_URI' => '/php/forms/request_method.php',
  'SCRIPT_FILENAME' => '/home/w3dx/@subdomains/alpha/public_html/php/forms/request_method.php',
  'QUERY_STRING' => '',
  'SCRIPT_URI' => 'http://alpha.w3dx.co.uk/php/forms/request_method.php',
  'SCRIPT_URL' => '/php/forms/request_method.php',
  'SCRIPT_NAME' => '/php/forms/request_method.php',
  'SERVER_PROTOCOL' => 'HTTP/1.1',
  'SERVER_SOFTWARE' => 'LiteSpeed',
  'REQUEST_METHOD' => 'GET',
  'X-LSCACHE' => 'on',
  'PHP_SELF' => '/php/forms/request_method.php',
  'REQUEST_TIME_FLOAT' => 1593953379.182159900665283203125,
  'REQUEST_TIME' => 1593953379,
)

[Home]