PHP Email Form Demo!

By: Emma Sullivan

#1 Make the Form

Imput Elements

The input element is the most important form element. It defines what the form element will look like. For this demo we will be using the text and submit imputs.

Text Input

The Text Input defines a one-line input field. This is where you put the information you would like the person to submit.

Create 3 more text input boxes. One for the persons email, one for their address, and one for their phone number.

Comment Box

The comment box has a textarea tag. You can state the number of rows and columns the box fills up. This is the section where people can leave additional comments.

Submit Button

The submit input type defines a button for submitting a form to a form-handler. For this we are submiting it using PHP.

Final Product

#3 The PHP file

PHP File

The basic template can be found online. Some are very complex and have many other features. Save the file in your site folder and make sure it has the same name as the one you named in the action section.

Who Sent the Email?

The first section uses the $ to call the information that you wish to be displayed. It will show what the person's name is and what their email is. You call the name using $ and say $_REQUEST['name'] to have the information that they typed into the form to display.

Creating the Message

In order to simply understand the form information after they send it you can make a message that turns all their text into a cohesive sentence.

Enter Your Email Address

In the mail section enter the email you wish the form to be sent to, in this case your email.

Upload the site to the server, fill out the form, then hit send! You should get an email sent to yourself!