1. Home
  2. Computing & Technology
  3. PHP / MySQL

Processing form data with PHP

By Angela Bradley, About.com

1 of 2

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:

<html>
<head><title>Test Page</title></head>
<body>
<h2>Data Collection</h2><p>
<form action="process.php" method="post">
<table>
<tr><td>Name:</td><td><input type="text" name="Name" /></td></tr>
<tr><td>Age:</td><td><input type="text" name="Age" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" /></td></tr>
</table>
</form>
</body>
</html>

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

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn PHP
  5. PHP Form - PHP Form Tutorial - PHP Form Script

©2009 About.com, a part of The New York Times Company.

All rights reserved.