Share on Google+Share on Google+

The $_Request Function

This section contains the detail about the $_Request Function in PHP.

The $_Request Function

The contents of both $_GET, $_POST, and $_COOKIE are contained by the PHP built-in $_REQUEST function. $_REQUEST Method is used to collect form data sent with both the GET and POST as follows :

Name : <?php echo $_REQUEST["name"]; ?><br />
Address :<?php echo $_REQUEST["address"]; ?>

Given below example will give you a clear idea :

Example :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE>Request Method in PHP</TITLE>
<h3>Fill the Below Form :</h3>
<form action="RequestMethod.php" method="post">
Name&nbsp&nbsp&nbsp&nbsp: <input type="text" name="name" /><br>
Address : <input type="text" name="address" /><br/>
<input type="submit" name="submit"/>

Your Name :<?php echo $_REQUEST["name"]; ?>.<br />
Address :<?php echo $_REQUEST["address"]; ?>

Output :

First, you need to fill up the form as : 

When you press the submit button, it will show you the following :

Download Source Code



Posted on: February 4, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null