The $_GET Function
The built-in $_GET function is used to collect values from a form sent with method="get". Information sent from a form with the GET method is visible to everyone and has limits on the amount of information to send (max. 100 characters). The values will be displayed in the browser's address bar. Below simple program will explain this breifly.
Example:
When the user clicks the "Submit" button, the form values will be sent to server through URL. When you click the submit button the URL will be look like this
Now you can use $_GET function on view.php page and get the form values. Form fields will automatically be the keys in the $_GET array.
The output is look like this:
The built-in $_GET function is used to collect values from a form sent with method="get". Information sent from a form with the GET method is visible to everyone and has limits on the amount of information to send (max. 100 characters). The values will be displayed in the browser's address bar. Below simple program will explain this breifly.
Example:
<form action="view.php" method="get"> Article: <input type="text" name="article" /> Price: <input type="text" name="price" /> <input type="submit" /> </form>
When the user clicks the "Submit" button, the form values will be sent to server through URL. When you click the submit button the URL will be look like this
http://www.u3schools.com/view.php?article=Nokia1200&price=1540
Now you can use $_GET function on view.php page and get the form values. Form fields will automatically be the keys in the $_GET array.
Article name <?php echo $_GET["article"]; ?>.<br /> Article price <?php echo $_GET["price"]; ?> INR(Indian rupees)
The output is look like this:
Article name Nokia1200 Article price 1540 INR(Indian rupees)
0 comments:
Post a Comment