Codecademy Logo

PHP Form Handling

$_REQUEST Superglobal Variable

The $_REQUEST superglobal variable is an array that contains data from the clients cookies, GET and POST request.

Action Form Attribute

The “action” form attribute is used to specify which PHP file handles the request being submitted. The PHP file handling the request can be the same file sending the request or a separate file.

$_POST Superglobal Variable

$_POST, the PHP superglobal variable, is an array that contains data from the client’s POST request. This data is translated from the HTTP request headers

$_GET Superglobal Variable

$_GET is a PHP superglobal variable which is used to collect an array of data transmitted within the URL parameters of a client’s incoming GET request.

echo Shorthand Syntax

Instead of using the regular echo syntax like <?php echo "Hello World"; ?> we can use a shorthand syntax such as <?= "Hello World"; ?>.

HTML Form Name Attribute

The name attribute is used to associate data with an input tag so that PHP can access the data. Unique name attribute values are needed for each input tag.