In PHP, $_GET and $_POST are superglobals used to send data from browser to web browser (e.g., in form handling).
Although both variables are used in collecting data, there are significant differences in how they’re used.
$_GET is an associative array of variables passed to the current script via the URL parameters (HTTP GET method).
HTTP GET method:
$_POST is an associative array of variables passed to the current script via the HTTP POST request method.
HTTP POST method:
Use $_GET (HTTP GET method) if your data is short text data that does not contain any sensitive information.
Use $_POST (HTTP POST method) to send lengthy data or binary data, like images. It is also used to send sensitive information.
Read more about the difference between HTTP GET and POST methods here.
View all Courses