Download and learn how this simple PHP Contact Form Script was made. Technologies used include PHP OOP, MySQL, Bootstrap and HTML5.
- 1 Script Overview
- 2 Is This Code For Me?
- 3 Pre-Requisite
- 4 Output Preview
- 5 Database Design
- 6 File Structure
- 7 What People Say?
- 8 Features List & Download - PHP Contact Form Script
- 9 Simple Set Up
- 10 Related Source Code Modules
- 11 Thank You!
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.
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.
Before you download, please make sure you have basic understanding of the following topics.
Once you learned our tutorials above, this source code should be easy to understand.
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.
Our database name will be "php_contact_form", and we will have three tables: Messages, Settings and Users.
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.
What People Say?
Here's what people feel about our work and source code downloads.
"Wow, I love you guys! The best web programming tutorial I’ve ever seen. So comprehensive, yet easy to follow. I love how you combine all necessary elements in such a neat structure."
"The fact that you’ve put it all together saves so much time and its worth buying the code. Makes me feel good supporting a developer like yourself. Keep up the good work!"
"Thanks for making these awesome tutorials! I bought your source codes. To be honest, it’s very readable code and helps me understand a lot of things and how it’s done in PHP. Thanks for that again."
Features List & Download - PHP Contact Form Script
|FEATURE||PHP CONTACT FORM SCRIPT|
|Learn more techniques when coding with PHP, MySQL and OOP||YES|
|Save your precious time coding and searching about how to do the features below.||YES|
|PHP PDO and Prepared Statements||YES|
|Buttons are displayed with appropriate icons||YES|
|Client side validation (HTML5)||YES|
|Server side validation (PHP)||YES|
|Display contact email from settings||YES|
|Display contact number from settings||YES|
|Display contact person from settings||YES|
|Store customer message to database||YES|
|Send message to contact email (email set in the settings)||YES|
|Send confirmation email to customer||YES|
|Sending email can work via localhost using the PhpMailer library||YES|
|Uses htmlspecialchars($_SERVER["PHP_SELF"]) for form action||YES|
|Made sure $_SERVER["REQUEST_METHOD"]=="POST"||YES|
|Sanitize each submitted field with htmlspecialchars(), strip_tags() and trim() functions||YES|
|Require value for each field||YES|
|Show an error message under input fields if value is missing||YES|
|Validate email address format||YES|
|Keep values in the form if there are any error||YES|
|List messages collected from customers using the contact form||YES|
|Display name, subject, sent and action columns||YES|
|Unread messages in white row background||YES|
|Read messages in gray row background||YES|
|Pagination of messages||YES|
|Search messages by name, email, subject and message fields||YES|
|Read a message||YES|
|Delete a message||YES|
|Setting for contact firstname||YES|
|Setting for contact lastname||YES|
|Setting for contact gender||YES|
|Setting for contact email||YES|
|Setting for contact number||YES|
|Decide if you'll show contact name||YES|
|Decide if you'll show email||YES|
|Decide if you'll show contact number||YES|
|Login using email and password||YES|
|Log out user||YES|
|Hashed password stored in database||YES|
|Logged-in user name display on the right side of navigation bar||YES|
|Log-out button displayed on drop-down when user name was clicked||YES|
|Messages can be read by logged-in admin.||YES|
|Messages can be deleted by logged-in admin.||YES|
|SUPPORT AND UPDATES|
|Free support for 6 months.||YES|
|Free source code updates.||YES|
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)
5. Run the login.php file on your browser, use the following user credentials.
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.
|PHP Login & Registration Module|
|PHP Shopping Cart Module|
|PHP Product Catalog Module|
|PHP Content Management Module|
|PHP Contact Form Module|
|PHP PayPal Integration Module|
Thank you for reading about this PHP Contact Form Script source code and supporting our projects here at codeofaninja.com!