Home Tutorial Php Phpbeginners The $_Request Function

 
 

Share on Google+Share on Google+
The $_Request Function
Posted on: February 4, 2011 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for The $_Request Function:


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.

Posted on: February 4, 2011

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com