web 2.0

How to use PHP & REQUEST Method ($_REQUEST)

How to use PHP & REQUEST Method ($_REQUEST) Learn PHP how to using REQUEST method and read a php variable from $_REQUEST method.

ShotDev Focus:
- Using PHP & $_REQUEST method.

Example

php_request1.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form action="php_request2.php?Version=2010" method="post" name="form1">
Name
<input name="txtName" type="text">
SiteName
<input name="txtSiteName" type="text">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

php_request2.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php
echo $_REQUEST["txtName"]."<br>"; // txtName
echo $_REQUEST["txtSiteName"]."<br>"; // txtSiteName
echo $_REQUEST["Version"]."<br>"; // Version
echo "<hr>";

foreach($_REQUEST as $key => $val) // All Key & Value
{
echo $key . " : " . $val . "<br>";
}
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_request1.php

Screenshot

PHP REQUEST

PHP REQUEST

.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.