What is the use of the $_REQUEST variable in PHP ? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 31 Likes 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 K khurpaderushi143 Follow 31 Improve K khurpaderushi143 Follow 31 Improve Article Tags : Web Technologies PHP Geeks Premier League Geeks-Premier-League-2022 PHP-Questions Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like