How To Create A PHP Contact Form
How To Create A PHP Contact Form
Written by:
David Friedman
Table of Contents
Introduction ................................................................................................ 3
Materials Needed ........................................................................................ 3
Instructions ................................................................................................. 3
Source Code ................................................................................................ 4
References .................................................................................................. 6
2
How to Create a PHP Contact Form 2008
Introduction
This is a supplemental manual that will assist you when viewing my tutorial on how to
create a PHP contact form. The intended audience for this tutorial is for someone who
has basic HTML and PHP knowledge. My tutorial will assist you in developing a simple
PHP contact form for your web site so that a user can send an email directly to you.
Materials Needed
Desktop computer or laptop
Internet Access
Text Editor
Web Browser
A Web Site
Instructions
3. Open browser
a. Test to make sure the form looks correct
3
How to Create a PHP Contact Form 2008
5. Upload both files to your web site
a. Index.php
b. Mailform.php
6. Open browser
a. Test the mail form to make sure the email was sent
Source Code
1. Index.php:
<p>Message:<br/>
</form>”
2. Mailform.php:
“<?php
$email_address = $_POST['email'] ;
$subject = $_POST['subject'] ;
$message = $_POST['message'] ;
4
How to Create a PHP Contact Form 2008
echo "Thank you for using our mail form.<br/>";
?>”
5
How to Create a PHP Contact Form 2008
References
W3CSchools : World Wide Web Consortium. Retrieved March 24, 2008, Web
site: http://www.w3schools.com/php/php_mail.asp (for providing the source code)