The $_Request Function

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

 
 

Share on Google+Share on Google+

The $_Request Function

Ads

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">
<HTML>
<HEAD>
<TITLE>Request Method in PHP</TITLE>
</HEAD>
<BODY>
<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"/>
</form>
</BODY>
</HTML>

<?php
if(isset($_REQUEST['submit'])){
?>
Your Name :<?php echo $_REQUEST["name"]; ?>.<br />
Address :<?php echo $_REQUEST["address"]; ?>
<?php
}
?>

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

Advertisements

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