PHP Global Variables are also called superglobals and they are accessible everywhere on your code regardless of the scope. You can access them in any part of the file without adding additional code or whatsoever.
These are the Super Global Variables.
<html> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Name: <input type="text" name="first_name"> Age: <input type="text" name="age"> <input type="submit" value="Submit"> </body> </html>
Once you select the submit button, automatically, the values of the inputted data will be assigned to the $POST array. From our example we have two values namely the Name, and Age with the name "firstname" and "age" respectively. The names of the input will be placed in an associative array with the $POST variable. Shown like these if you do a vardump($POST).
$POST['firstname'] = "";
$POST['age'] = ""
The same as true with the $GET global variable. All you have to do is change the method from post to get.
So you might ask what is the difference between Get and Post?
When you use GET, the variables inputted will be visible in the URL. Like say www.caveofprogramming.com/articles?firstname="John"&age=23
Unlike with POST it is invisible to others, thus making it secure and safe.