www.pickatutorial.com Computer Tutorials
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons PHP $_GET Variable Bookmark and Share
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
Lesson 37
Lesson 38
Lesson 39
Lesson 40
Lesson 41
Lesson 42
Lesson 43
Lesson 44
The $_GET variable in php is used to collect values on the server side from a form that was submitted using the method="get".

In other words the $_GET variable is an array of variable names and values sent by the HTTP GET method. Please remember that the information sent from a form with the GET method is visible to everyone i.e. it is displayed in the browser's address bar and it also has limits on the amount of information to send.

Example
<form action="phpGET.php" method="get">
Name: <input type="text" name="name" /><br>
Occupation: <input type="text" name="occ" /><br>
<input type="submit" />
</form><br>

OUTPUT
Name:
Occupation:


When you click the "Submit" button, the internet browser would take you to a URL looking something like:

http://www.pickatutorial.com/phpGET.php?name=abc&occ=xyz

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

$name = $_GET["name"];
$occupation = $_GET["occ"];


Be careful when using the html form method "get", as all variable names and values are displayed in the URL. So this method should not be used when sending passwords or other sensitive information to the server! The HTTP GET method is also not suitable on large variable values, as there is a limit on the length of a URL.
Next: PHP $_post


Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.