Here, we will demonstrate the use of the $_REQUEST superglobal variable by creating a submit button using the "post" method with the help of a form tag.
Here, we checked the request method using $_SERVER superglobal, then we get the value of the input field using $_REQUEST superglobal and then printed the country name using printf() function on the webpage.
Program/Source Code:
The source code to demonstrate the use of the $_REQUEST superglobal variable is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we create a form tag with the post method that contains an input field and a submit button.
Here, we checked the request method using $_SERVER superglobal, then we get the value of the input field using $_REQUEST superglobal and then printed the country name using printf() function on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer