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

A Practical PHP Form to Mail

By Angela Bradley, About.com

2 of 4

The Form Explained

The code on the last page collects seven pieces of data which we will explain here. It then submits the answers to a page called contact.php which we will create next.

First we use the option feature to create a drop down menu, allowing the user to direct their mail to different departments. Each of these values is set to a different email address. When submitted the form data will be directed to the appropriate email.

Next we collect information about the customer including their Name, Email, Company and Phone Number.

The user is then prompted to join our mailing list, and a radio button is set to default to "Yes".

Finally the user is given a chance to submit the body of their message in large text area.

This form could be copy-pasted into an existing page, or used as is. Don't feel bound to using these categories, you can collect as much or little information as you want using any HTML form input types.

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. Step By Steps
  5. PHP Email - PHP Email Form - PHP Email Script

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

All rights reserved.