When we submit form data to a URL or a page using either of these methods (i.e., GET and POST), how does this web page receive this data underneath the hood?
GET and POST are two request methods of the Hypertext Transfer Protocol (HTTP), which defines how the content we call a "web page" is transferred over the internet. On a more general level, internet traffic (not limited to web pages) is governed by a set of protocols known as TCP/IP. Together, these protocols define how computers communicate with each other as parts of the giant computer network we call the internet.
Your computer submits data to the web server in a request, and if the request is identified as a GET request, the web server treats it one way; if identified as a POST request, the web server treats it another way. Here's an example of what a simple GET request to load Wikipedia looks like "under the hood" on a client machine:
"Http request telnet ubuntu" by TheJosh - Own work. Licensed under Public domain via Wikimedia Commons.
The web server machine is simply another computer running software that implements the protocols as defined for a web server. You can set up pretty much any computer with an internet connection to serve web pages, it's simply a matter of the machine being able to listen for and respond to requests from other machines that are directed toward its unique address on the network.
So, the server receives GET and POST data in essentially the same way, but it recognizes which sequences indicate one or the other, similarly to the way that problem set 5 asks you to look for certain bytes in a big chunk of data that indicate the beginning of a JPEG file. Its software then takes the data and uses it to decide what actions to take in response. These actions could include sending you a different page, starting a file transfer, retrieving information from a database, storing information in a database, and so on.
And for the PHP part, who is responsible for constructing these super global variables (i.e.,
$POST) and storing the submitted data in them?
If you're looking for a lower-level explanation like the one David gave in the earlier lectures about how C stores variables in memory, then you might be interested in the history of the PHP language. It turns out that PHP is implemented in C, so the mechanical storage of data "under the hood" takes place in effectively the same way that you learned at the beginning of the course.