What is the use of the $_REQUEST variable in PHP ? Last Updated : 28 Mar, 2022 Comments Improve Suggest changes Like Article Like Report Uses of PHP $_REQUEST: The PHP $_REQUEST is a PHP superglobal variable that is used to collect the data after submitting the HTML forms as the $_REQUEST variable is useful to read the data from the submitted HTML open forms.$_REQUEST is an associative array that by default contains contents of an $_GET, $_POST, and $_COOKIE.The variables in a $_REQUEST super variable are obtained to the HTML scripts through GET, POST, and COOKIE inputs, so it could be changed by the remotely associated user and can't be trusted again.The presence $_REQUEST variable and the suited orders of $_REQUEST are variables listed in the array is declared similar to the PHP request_order, and variables_order configuration directives are it.PHP $_REQUEST is the featuring PHP superglobal variable which is used to collect data after submitting the HTML forms in the browserPHP's $_REQUEST is widely used to collect information that is after submitting from HTML browsed forms.The $_REQUEST function is used to get the form information sent with its POST method and the other GET method. Approach: The example demonstrates an HTML form with the input field and within having to submit button. When a user submits the information by clicking on the button "Submit", the filled data is sent to the file i.e. examined with actions attributes of the <form> tag within it We aim the file itself for preprocessing form data as we use another PHP file to preprocess a form data, replacing that with occurring filename of our choice. We use the PHP $_REQUEST super global variable to collect the value of the input field from it. Example: HTML <!DOCTYPE html> <html> <body> <!--Defining Form--> <h1 style="color:green">GeeksforGeeks</h1> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Name: <input type="text" name="pname"> <input type="submit"> </form> <?php // Getting $REQUEST METHOD if ($_SERVER["REQUEST_METHOD"]=="POST") { $name = htmlspecialchars($_REQUEST['pname']); // Collecting the value of input field from it if (empty($name)) { echo "Name is empty"; } else { // Printing the entered data echo $name; } } ?> </body> </html> Output: For The String "GeeksforGeeks" Comment More infoAdvertise with us Next Article What is the use of the $_REQUEST variable in PHP ? K khurpaderushi143 Follow Improve Article Tags : Web Technologies PHP Geeks Premier League Geeks-Premier-League-2022 PHP-Questions Similar Reads What is the use of $GLOBALS in PHP ? In this article, we will discuss $GLOBALS in PHP. $GLOBALS is a superglobal variable used to access global variables from anywhere in the PHP program. PHP stores all global variables in an array called $GLOBALS[index]. Syntax: $GLOBALS['index']=value;value is the input value.The index is the unique 1 min read What is the purpose of php.ini file ? In this article, we will learn about the purpose of the php.ini file. At the time of PHP installation, php.ini was a special file provided as a default configuration file.Purpose of php.ini file:Itâs a very essential configuration file that controls what a user can or cannot do with the website.Each 5 min read When should one use require_once() vs require() in PHP ? In this article, we will learn, when should one use the require_once() method and when to use require() method in PHP. require() Method: PHP require() is a library or built-in function in PHP. It is generally used in situations where we want to include a file in the PHP code or program. The require( 3 min read What are pre-request scripts in Postman, and how are they used? Postman is an API(application programming interface) development tool which helps to build, test and modify APIs. It has the ability to make various types of HTTP requests(GET, POST, PUT, PATCH), save environments for later use, converting the API to code for various languages(like JavaScript, Pytho 2 min read What are the differences between PHP constants and variables ? PHP Constants: PHP Constants are the identifiers that remain the same. Usually, it does not change during the execution of the script. They are case-sensitive. By default, constant identifiers are always uppercase. Usually, a Constant name starts with an underscore or a letter which is followed by a 2 min read Like