PHP Tutorial – $_REQUEST Function

In previous tutorials we already looked at the PHP built-in $_GET function and $_POST function. In this tutorial we take a quick look at the PHP built-in $_REQUEST function.

The PHP built-in $_REQUEST function can be used with both the GET and POST methods.

Let’s take a look at an $_REQUEST function example:


<html>
<body>

<form action="test.php" method="post">
Your name: <input type="text" name="yourname" />
<input type="submit" />
</form>

</body>
</html>

In the test.php script we can do the following (note: that we have use the POST method in the form):


Welcome <?php echo $_REQUEST ["yourname"]; ?>!

That’s all for this tutorial. (We said it would be a quick look ;-) )

This entry was posted in PHP Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

There are currently 5 responses to “PHP Tutorial – $_REQUEST Function”

Why not let us know what you think by adding your own comment!

  1. pratik on August 31st, 2012:

    good example thanks for it.i get the idea properly again thanks…..

  2. Fabho on March 27th, 2013:

    Wow cool,,, That fors this fast fast tutorial :D

  3. g on August 8th, 2013:

    very useful, fast, easy to understand.

  4. mns on September 28th, 2013:

    it’s so nice ,Really this example help me so much…..

  5. V.Antony Bruce Merlin on January 17th, 2014:

    Thankyou…. for the short and good example…