Create Simple Contact Form with CodeIgniter

A contact page is a standard web page on a website used to allow the visitor to contact the Web Application admin. In this tutorial, you will learn how to create a CodeIgniter contact page with Bootstrap.
The post covered in easy steps with live to create a CodeIgniter contact page with Bootstrap.This is a very simple example, you can just copy paste, and change according to your requirement.
Before started to implement the Create Contact Form with CodeIgniter, look files structure:
  • codeigniter-contact-form
    • application
      • config
        • autoload.php
        • constants.php
        • config.php
        • routes.php
      • controllers
        • Contact.php
      • views
        • contact
          • index.php
        • mailTemplate
          • contactForm.php
        • templates
          • header.php
          • footer.php
    • system
    • index.php
    • assets
      • css
        • style.css
Step 1: Update constants file
Create a config file named “constants.php” inside “application/config” folder.
Step 2: Load “email” class in controller.
Set Email Parameters
Step 2: Create a controller file
Create a controller file named “Contact.php” inside “application/controllers” folder.
Step 3: Create a view
Create a view file named “index.php” inside “application/views/contact” folder.
Step 4: Create a view(mailTemplate)
Create a view file named “contactForm.php” inside “application/views/mailTemplate” folder.
Create header setion
The Bootstrap library is used to provide a better UI, so, include it in the header section. Located at the top of a web application, the header typically contains elements that include a company’s logo, website navigation, and other information.
Create a view file named "header.php" inside "application/views/templates" folder.
Create footer setion
  • Include Bootstrap plugin
  • Include jQuery plugins and JavaScript file
Create a view file named "footer.php" inside "application/views/templates" folder.