PHPsu
MANUAL ZH  |  EN
     


Current Position :| index>Beginners> PHP $_GET

PHP $_GET

FROM: AUTHOR: TIME:2008-03-29 HITS:

The $_GET variable is used to collect values from a form with method="get".

do you kown phpsu.com?


The $_GET Variable

The $_GET variable is an array of variable names and values sent by the HTTP GET method. phpsu.com

The $_GET variable is used to collect values from a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and it has limits on the amount of information to send (max. 100 characters).

do you kown phpsu.com?

Example

<form action="welcome.php" method="get">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
phpsu.com is a free phpscool

When the user clicks the "Submit" button, the URL sent could look something like this:

phpsu.com is a free phpscool

http://www.w3schools.com/welcome.php?name=Peter&age=37 

phpsu提供的php教程

The "welcome.php" file can now use the $_GET variable to catch the form data (notice that the names of the form fields will automatically be the ID keys in the $_GET array):

www.phpsu.com

Welcome <?php echo $_GET["name"]; ?>.<br />
You are <?php echo $_GET["age"]; ?> years old!
do you kown phpsu.com?


Why use $_GET?

Note: When using the $_GET variable all variable names and values are displayed in the URL. So this method should not be used when sending passwords or other sensitive information! However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases. phpsu.com

Note: The HTTP GET method is not suitable on large variable values; the value cannot exceed 100 characters. www.phpsu.com


The $_REQUEST Variable

The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE. http://www.phpsu.com

The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.

phpsu

Example

Welcome <?php echo $_REQUEST["name"]; ?>.<br />
You are <?php echo $_REQUEST["age"]; ?> years old! phpsu is a phpschool



TITLE:PHP $_GET
Copyright 2008 The PHPsu All rights reserved. This mirror generously provided by: .Hp Inc.
Last updated: Fri Jun 6 22:44:59 GMT-8 2008