Home PHP

PHP Contact Form Script – Messages Module – Download Now!

simple-php-contact-form-script

Download and learn how this simple PHP Contact Form Script was made. Technologies used include PHP OOP, MySQL, Bootstrap and HTML5.

Contents of this page include:

1.0 Script Overview
2.0 Is This Code For Me?
3.0 Pre-Requisite
4.0 Output Demo Link
5.0 Database Design
6.0 File Structure
7.0 What People Say
8.0 Features List & Download
9.0 Simple Set Up
10.0 Related Source Codes
11.0 Thank You!

1.0 Script Overview

This source code will enable you to add a ‘contact form’ feature on your website. This source code is a very good starting point if you’re trying to build your own ‘Contact Form Script’ from scratch and add some more complex features later.

This is because the basis of this source code are our step by step and easy to understand tutorial. Specifically this tutorial: PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!

The system looks simple. But I assure you that when you study the source code, you will learn a lot of useful PHP coding techniques.

Some include: How to send a message to a valid email address from a web form, use of settings for your contact form, collecting and storing customer messages on your own database, admin restrictions and more! You can see the detailed list of features on section 6.0 below.

2.0 Is This Code For Me?

The source code in this page is NOT for you if:

  • You are already an expert in PHP & MySQL programming.
  • You have a lot of time to code the listed features of our PHP contact form script
  • You are not that interested in learning PHP & MySQL programming.

But, this SOURCE CODE is FOR YOU if:

  • You want to SAVE a significant amount of development time.
  • You want to develop your own PHP contact form script from scratch.
  • You determined to learn how to make a this web application feature in PHP & MySQL.
  • You need some guidance in learning about this script (I’ll personally support you & answer your questions)

But if you are an expert in PHP & MySQL programming and would like to take a look at our code, please do so! We’d love to hear your response and great insights! The comments section below is always open for anyone with questions and suggestions.

3.0 Pre-Requisite

Before you download, please make sure you have basic understanding of the following topics.

a. PHP, MySQL and OOP CRUD Tutorial – Step by Step Guide!
b. Apache .htaccess RewriteRule Examples

Once you learned our tutorials above, this source code should be easy to understand.

4.0 Output Preview

Below are some screenshots of our script’s output. You can click an image to view the larger version of it.

Please note that the following images are just output previews. New features might be added already the time you are reading this.


If you need the live demo link, send a request to mike@codeofaninja.com with subject “DEMO Request: PHP Contact Form & Messages Module”, thank you!

5.0 Database Design

Our database name will be “php_contact_form”, and we will have three tables: Messages, Settings and Users.

database-design-php-contact-form-script

6.0 File Structure

The following folders and files are included in our source code. It will have more meaning if you will see the code inside the folders and files.
├─ admin/
├─── delete_message.php
├─── index.php
├─── layout_foot.php
├─── layout_head.php
├─── login_checker.php
├─── navigation.php
├─── paging.php
├─── read_message.php
├─── read_message_template.php
├─── search_messages.php
├─── settings.php
├─ config/
├─── core.php
├─── database.php
├─ dev/
├─── php_contact_form.sql
├─── readme.txt
├─ images/
├─ libs/
├─── css/
├────── bootstrap/
├────── font-awesome/
├─── js/
├────── bootbox.min.js
├────── custom-script.js
├────── jquery.js
├─── php/
├────── pw-hashing/
├────── utils.php
├─ objects/
├─── message.php
├─── setting.php
├─── user.php
├─ .htaccess
├─ contact.php
├─ index.php
├─ info.php
├─ layout_foot.php
├─ layout_head.php
├─ login.php
├─ logout.php
├─ navigation.php

7.0 What People Say?

Here are some of the things people say about our source code downloads.

★★★★★ “I have purchased both your (PHP) CRUD Level 2, and Level 3 applications so that I can improve my programming skills. YOU’RE THE MAN! I would say that I should have contacted you three days ago, I learned a lot!!!”

Kevin Richards
Web Developer, Recruiter Solutions

★★★★★ “Mike, thank you for the great (PHP CRUD) tutorial and quick response, I finally figured it out and got it working!”

Ira Rabinowitz
Web Developer & Designer, LinkedIn Profile

★★★★★ “Awesome! everything is looking great (PHP Shopping Cart). You’re my new hero this is all great. We couldn’t be happier. You will be paid more.”

Joshua Duncan
Product Manager, LinkedIn Profile

8.0 Features List & Download – PHP Contact Form Script

FEATUREPHP CONTACT FORM SCRIPT
Learn more techniques when coding with PHP, MySQL and OOPYES
Save your precious time coding and searching about how to do the features below.YES
PHP PDO and Prepared StatementsYES
jQuery enabledYES
Bootstrap enabledYES
Font-awesome enabledYES
Buttons are displayed with appropriate iconsYES
CONTACT FORM
Name fieldYES
Email fieldYES
Subject fieldYES
Message fieldYES
Client side validation (HTML5)YES
Server side validation (PHP)YES
Display contact email from settingsYES
Display contact number from settingsYES
Display contact person from settingsYES
Store customer message to databaseYES
Send message to contact email (email set in the settings)YES
Send confirmation email to customerYES
Sending email can work via localhost using the PhpMailer libraryYES
FORM SECURITY
Uses htmlspecialchars($_SERVER[“PHP_SELF”]) for form actionYES
Made sure $_SERVER[“REQUEST_METHOD”]==”POST”YES
Sanitize each submitted field with htmlspecialchars(), strip_tags() and trim() functionsYES
Require value for each fieldYES
Show an error message under input fields if value is missingYES
Validate email address formatYES
Keep values in the form if there are any errorYES
MESSAGES
List messages collected from customers using the contact formYES
Display name, subject, sent and action columnsYES
Unread messages in white row backgroundYES
Read messages in gray row backgroundYES
Pagination of messagesYES
Search messages by name, email, subject and message fieldsYES
Read a messageYES
Delete a messageYES
SETTINGS
Setting for contact firstnameYES
Setting for contact lastnameYES
Setting for contact genderYES
Setting for contact emailYES
Setting for contact numberYES
Decide if you’ll show contact nameYES
Decide if you’ll show emailYES
Decide if you’ll show contact numberYES
USER
Login using email and passwordYES
Log out userYES
Hashed password stored in databaseYES
Logged-in user name display on the right side of navigation barYES
Log-out button displayed on drop-down when user name was clickedYES
Messages can be read by logged-in admin.YES
Messages can be deleted by logged-in admin.YES
UPDATES AND SUPPORT
Free source code updates for 2 yearsYES
Free support for 6 monthsYES

9.0 Simple Set Up

By now, you were able to download this (PHP Contact Form Script) source code. Here are the few instructions about how to run it.

1. Copy the extracted files to your localhost or upload it to your webserver.

2. You have to create your database using PhpMyAdmin, name of the database: php_contact_form

3. Import the SQL file called “php_contact_form.sql” located in the “dev” folder.

4. Change line 7 .htaccess file (No changes should be made if you put the files on the root directory of your localhost)

RewriteBase /YOUR_ROOT_DIRECTORY/

5. Run the login.php file on your browser, use the following user credentials.

Username: mike@example.com
Password: ninja12qw!@QW

6. To see the contact form, run contact.php

Related Source Code Modules

You can download the PHP SHOPPING CART SYSTEM by modules. Learn more by clicking any 'View Module' button below.

ModulesAction
PHP Users & Login System
PHP Product Catalog
PHP Shopping Cart & Ordering
PHP Web Page Content Management
PHP Contact Form & Messages
PHP & PayPal Integration

You can download the different modules right now by checking multiple check-boxes and clicking the "Download Now" button below.

Download Now

11.0 Thank You!

Thank you for reading about this PHP Contact Form Script source code and supporting our projects here at codeofaninja.com!

If you have any questions, comments or suggestions, please do not hesitate to contact me.
a. Send me an email. My email address is mike@codeofaninja.com
b. Go to https://fb.com/codeofaninja and chat me up.