Processing Form Data With PHP

Processing Form Data With PHP

We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.

01of 02

Using a Form to Collect Data

Here we are going to learn how to take data from the user through an HTML form and then process it through a PHP program and output it. If you are interested in making PHP work with SQL you should visit this tutorial and if you are interested in sending data via email you should visit this tutorial as neither concepts will be covered in this lesson.

For this tutorial you will need to create two pages. On the first page we will create a simple HTML form to collect some data. Here is an example:

Test Page

Data Collection


This page will send the Name and Age data to the page process.php

02of 02

Processing the Form Data

Now lets create process.php to use the data from the HTML form we made:

"; print "You are ". $Age . " years old"; print "
"; $old = 25 + $Age; print "In 25 years you will be " . $old . " years old"; ?> var13 -->

As you may be aware, if you leave out the method="post" part of the form, the URL with show the data. For example if your name is Bill Jones and you are 35 years old, our process.php page will display as // If you want, you can manually change the URL in this way and the output will change accordingly.


  1. Alburn

    Quite right! I like this idea, I completely agree with you.

  2. Colyn

    Thanks for the explanation. I did not know this.

  3. Voodootaxe

    Aha, so too it seemed to me.

Write a message