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.

2 of 4

Index: A Practical PHP Form to Mail

  1. The HTML Form
  2. The Form Explained
  3. Processing With PHP
  4. The PHP Explained

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Step By Steps
  5. PHP Email - PHP Email Form - PHP Email Script

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

All rights reserved.