H I O X INDIA
FREE PHP Topics
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Common Header
Random Number
Type
Form Variables
Date and Time
PHP Mysql Functions
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
Running PHP from JS
Array To JS
Array to PHP
Encryption
Ask Your Doubts
Feedback





GET Method in PHP


Topic

How to use GET method in PHP to get form values?



Explanation

Consider a simple form which contains a username, email address and a submit button.

A Simple Form:
Name:

Email:


When the user fill the form and click submit button the form will be submitted.

Coding to create a simple form

<form action="get.php" method="GET">
Name: <input type="text" name="name">
Email: <input type="text" name="mail">
<input type="submit" value="Submit">
</form>

To use GET method to get form values, you have to specify method = GET in the code.

Here GET method is used to access the form values. when submit button is clicked, the form data will be send to get.php file mentioned in the action part.

In get.php file $_GET variable is used to collect values from the form.

When GET method is used then the form data is passed through the URL ie, URL will contain form data.

http://www.hscripts.com/tutorials/php/get.php?name=admin&mail=ad@hiox.com

In this get.php file the value can be accessed as by using $_GET variable.

Welcome <?php echo $_GET["name"]; ?>
your Email <?php echo $_GET["mail"];?>


OR

Assign the form data to a variable and make use of variable in the script. This is done by using PHP $_GET variable.
$name=$_GET["name"];
$mail=$_GET["mail"];


RESULT:
Welcome Admin
your Email Ad@hiox.com






others


privacypolicy     licence     sitemap
(c) copyright, 2004 hioxindia.com