We're going to create only one controller in this project, which is /path/to/codeigniter/application/controllers/signup.php
.
Let's go over this controller now, look at the code, and discuss how it functions.
Create the /path/to/codeigniter/application/controllers/signup.php
file and add the following code to it:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Signup extends MY_Controller { function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('url'); $this->load->model('Signup_model'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>'); } public function index() {
This function creates a subscriber in the database, so the first thing we need to do is set the form validation rules:
// Set validation rules $this->form_validation->...