$_REQUEST is a superglobal variable in PHP that contains input from $_POST
, $_GET
, and $_COOKIE
. These correspond to HTTP POST, GET, and Cookies.
The following example shows how \$_REQUEST
can be used:
<?php// Choosing input typeif ($_SERVER["REQUEST_METHOD"] == "POST") {// Getting data from input$shotname = htmlspecialchars($_REQUEST['shot']);echo $shotname}?>
This example shows how $_REQUEST
can be used once a request has been made:
POST
request.$_REQUEST['shot']
. As can be seen, $_REQUEST
acts as an associative array as it uses a key to access data.htmlspecialchars()
, and displayed.Free Resources