Friday, 19 April 2013

PHP $ _GET


$ _GET Function.
$ _GET Function is used to get the value of the form method = "get".
Information sent from a form that uses method = "get" can be viewed by everyone as it will arise under the address bar and the information can be received very limited because of not more than 100 characters.

EXAMPLE:
<html>
The source code is action="user.php" method="get">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
</ form>
</ html>

user.php file
<? php
echo 'Your name:'. $ _GET ['Name']. '<br />';
echo 'Your age:'. $ _GET ['Age']. 'years';
?>

RESULTS:
If you enter 'Budi' on the field name and '20 'on the life of the field will be printed.
Your name: Budi
Your Age: 20 years

When you should use method = "get"?
When you use method = "get" then all the information will be visible in the address bar.

Important: As good method = "get" was not in use when you are done inputting important data such as passwords as they will appear in the address bar.

No comments:

Post a Comment