$_SERVER contains server information like what request method has been user (GET or POST?), if the request went through a secure connection, what is the IP address of the client making the request, etc.
Check out php.net for detailed explanation.
sheree
2016-08-04 02:09:39 UTC
It looks like in the above example, $_SE is (or is as a minimum the commencing) of the variable. $_ is just not perpetually a variable in Hypertext Preprocessor love it is in Perl. After I code personal home page, I usually use $_ to personal variables in lessons, or transitority variables in procedural scripts.
Kaydell
2012-11-17 11:05:24 UTC
$_GET is an array of things that the user has entered into an HTML form and pressed the submit button. These parameters are a part of the URL.
$_POST is an array of things that the user has entered into an HTML form too, but the form has specified "post" instead of "get".
For HTML forms, you usually use "post" instead of "get". "get" can be useful when you want to pass parameters from one of your pages to another and you put the parameters into the URL. On the receiving side, the parameters are magically in the $_GET array.
I haven't used $_SERVER very much and I haven't used $_REMOTE at all, so I won't comment on these arrays.
anonymous
2012-11-17 11:04:41 UTC
You mean
$_GET
$_POST
$_SERVER
$_REMOTE
First of all, I don't think $_REMOTE exists. They are all global variables.
$_GET and $_POST are both arrays. PHP parses submitted data for you and puts it in there.
http://mysite.com/test.php?a=1&b=2
$_GET['a'] will be 1
$_GET['b'] will be 2
$_SERVER is an array of global server information, like your host name, the file being called, the user's IP address, idunno, whatever http://php.net/manual/en/reserved.variables.server.php
$_SERVER['REMOTE_ADDR'] will give you the user's IP address. Based on that you can track where they live and kill them or something. have fun!
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.