www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons PHP Forms 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
PHP Forms and User Input
The PHP $_GET and $_POST variables are used to retrieve information from HTML forms. Let's see an example:

Example Form Code
<html>
<body>
<form action="forms.php" method="post">
Name: <input type="text" name="name" /><br>
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>

Example Form Output
Name:
Age:

The example HTML page above contains two input fields; Name and Age. When a user fills in this form and clicks on the submit button, the form data is sent to the "forms.php" file.

In forms.php file we can retrieve those values and use them as we need. The code of the forms.php file follows:

<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
Your age is <?php echo $_POST["age"]; ?> years.
</body>
</html>



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