class Register extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="text-danger">', '</div>');
$this->load->library('session');
$this->load->helper('url');
}
function index() {
$this->_init_session();
$data = [
'title' => 'NCRS - Register',
'active' => 'register',
];
$this->load->view('header', $data);
$this->load->view('register');
$this->load->view('footer');
}
//Route: /register/f1
function f1() {
$this->session->set_userdata($_REQUEST);
$this->form_validation->set_rules('name', 'Name', 'required|min_length[1]|max_length[125]');
$this->form_validation->set_rules('phone', 'Phone', 'required|min_length[12]|max_length[18]');
if ($this->form_validation->run() == FALSE) {
$data = [
'title' => 'NCRS - Contact Info',
'active' => 'register',
];
$this->load->view('header', $data);
$this->load->view('f1');
$this->load->view('footer');
}
else
redirect('/register/f2');
}
...