PHP Tutorials


PHP $_REQUEST
March 4, 2008, 12:52 am
Filed under: PHP

PHP $_REQUEST
This variable contains the content of both $_GET, $_COOKIE, and $_POST.

This can get the values passed from the form with both the GET and POST methods.

Here are 2 examples:

<form action=”myphp.php” method=”POST”>
Firstname: <input type=”text” name=”firstname” />
Lastname: <input type=”text” name=”lastname” />
<input type=”submit” />
</form>

<?php
echo “Firstname: “ $_REQUEST[“firstname”]; . <br />;
echo “Lastname: “ $_REQUEST[“lastname”];
?>

OR

<form action=”myphp.php” method=”GET”>
Firstname: <input type=”text” name=”firstname” />
Lastname: <input type=”text” name=”lastname” />
<input type=”submit” />
</form>

<?php
echo “Firstname: “ . $_REQUEST[“firstname”] . “<br />”;
echo “Lastname: “ . $_REQUEST[“lastname”] ;
?>

 

About these ads

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



Follow

Get every new post delivered to your Inbox.

%d bloggers like this: