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' => '*/*',
  'HTTP_ACCEPT_ENCODING' => 'gzip, br, zstd, deflate',
  'HTTP_HOST' => 'www.alpha.w3dx.co.uk',
  'HTTP_USER_AGENT' => 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)',
  'DOCUMENT_ROOT' => '/home/w3dx/@subdomains/alpha/public_html',
  'REMOTE_ADDR' => '216.73.216.11',
  'REMOTE_PORT' => '26497',
  'SERVER_ADDR' => '185.199.220.59',
  'SERVER_NAME' => 'www.alpha.w3dx.co.uk',
  'SERVER_ADMIN' => 'webmaster@alpha.w3dx.co.uk',
  'SERVER_PORT' => '443',
  'REQUEST_SCHEME' => 'https',
  'REQUEST_URI' => '/php/forms/request_method.php',
  'HTTPS' => 'on',
  'CRAWLER_USLEEP' => '1000',
  'CRAWLER_LOAD_LIMIT' => '20',
  'X_SPDY' => 'HTTP2',
  'SSL_PROTOCOL' => 'TLSv1.3',
  'SSL_CIPHER' => 'TLS_AES_256_GCM_SHA384',
  'SSL_CIPHER_USEKEYSIZE' => '256',
  'SSL_CIPHER_ALGKEYSIZE' => '256',
  'SCRIPT_FILENAME' => '/home/w3dx/@subdomains/alpha/public_html/php/forms/request_method.php',
  'QUERY_STRING' => '',
  'SCRIPT_URI' => 'https://www.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,crawler',
  'PHP_SELF' => '/php/forms/request_method.php',
  'REQUEST_TIME_FLOAT' => 1776418729.405396,
  'REQUEST_TIME' => 1776418729,
)

[Home]