The $_GET variable is used To collect values in a form with form method "get"
Information sent from the GET method is visible in url and displayed in the browser's address bar.
The get method is not suitable for very large variable values. It should not be used with values exceeding 2000 characters.
Example
<form action="target.php" method="get"> UserName: <input type="text" name="username" /> Country: <input type="text" name="country" /> <input type="submit" /> </form> When the user press the "Submit" button, the URL sent to the server look like below: http://www.test.com/target.php?username=Hiren&country=indiaThe "target.php" file can now use the $_GET variable to collect form data (the names of the form fields will automatically be the keys in the $_GET array):
Welcome <?php echo $_GET["username"]; ?>. You are from <?php echo $_GET["country"]; ?> country!
When should use "get" method?
When using method="get" in HTML forms, all variable names and values are displayed in the addressbar.Note: get method should not be used when sending sensitive information like password!
1 comment:
I want to thank you for writing this article.This is great Article for me...
Hire PHP developer in India
Post a Comment