samedi 22 octobre 2016

$_SERVER Superglobal Array in PHP

I was reading some code like this:

if ($_SERVER["REQUEST_METHOD"] == "POST") {
   echo "Hello ". $_POST['alias'];
}

But since we have already use $_POST, which means that it has to be used by post method, why we still need to use "$_SERVER["REQUEST_METHOD"] == "POST"? Another question is, if we submit a lot of form using both post and get methods, so what's the value of $_SERVER["REQUEST_METHOD"], does it only save the latest method value?




Aucun commentaire:

Enregistrer un commentaire