1. Computing

A Practical PHP Form to Mail

By , About.com Guide

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.

Related Video
Basic PHP Syntax
Using PHP With HTML
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Step By Steps
  5. PHP Email - PHP Email Form - PHP Email Script

©2013 About.com. All rights reserved.