PHP,$_POST super global variable

what is $_POST super global variable in PHP and how it works in form submission


here, is code I am writing but don’t know how it works…

Hello!

It’s a convenience array where all the related data posted can be retrieved. PHP is just giving you a shortcut so you don’t have to parse the body of the request that was sent to the server.

When you submit data or send data through AJAX, the server (in whichever language it’s written) has to parse the contents and then deliver them to the consumer (the scripts, classes, controllers, etc.). In this case, PHP handles the request data, parses the contents sent by the client (your browser or AJAX) and conveniently stores this data on the $_POST array (only if the method used was POST). There’s also the $_REQUEST array that has all the data sent, regardless of the method (post, get, put, delete, etc.).

Of course, that’s a simplification, but it’s essentially what’s doing. Read online what’s the definition of a client, a server and what other methods exists besides post.

Does it help :slight_smile:?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.