Science, Tech, Math › Computer Science Processing Form Data With PHP Share Flipboard Email Print Computer Science PHP Programming Tutorials MySQL Commands Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Angela Bradley Computer Science Expert B.A, History, Eastern Oregon University Angela Bradley is a web designer and programming expert with over 15 years of experience. An expert in iOS software design and development, she specializes in building technical hybrid platforms. our editorial process Angela Bradley Updated June 15, 2017 01 of 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 Name:Age: This page will send the Name and Age data to the page process.php 02 of 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"; ?> 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 http://yoursite.com/process.php?Name=Bill+Jones&Age=35 If you want, you can manually change the URL in this way and the output will change accordingly. Cite this Article Format mla apa chicago Your Citation Bradley, Angela. "Processing Form Data With PHP." ThoughtCo, Jan. 29, 2020, thoughtco.com/processing-form-data-with-php-2693958. Bradley, Angela. (2020, January 29). Processing Form Data With PHP. Retrieved from https://www.thoughtco.com/processing-form-data-with-php-2693958 Bradley, Angela. "Processing Form Data With PHP." ThoughtCo. https://www.thoughtco.com/processing-form-data-with-php-2693958 (accessed January 28, 2021). copy citation