<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Register extends CI_Controller {

  public function __construct()
	{
		parent::__construct();


  
     
		$this->load->model('registers');
   
  
	}
	public function index()
	{
	$this->load->library('form_validation');
          $this->form_validation->set_rules( [
            ['field' => 'name', 'label' => 'plan', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
            ['field' => 'email', 'label' => 'plan_description', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
            ['field' => 'phone', 'label' => 'duration', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
            ['field' => 'name', 'label' => 'plan', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
            ['field' => 'email', 'label' => 'plan_description', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
            ['field' => 'phone', 'label' => 'duration', 'rules' => 'trim|required', 'errors' => ['required' => 'Please enter the %s.'],],
          
           
                   
          ]);
		  
	 
			
			    if( $this->registers->creates() ) : 
              $this->session->set_flashdata( "success",'Registered  successfully' );
              redirect( 'dash' );
            else :
              $this->session->set_flashdata( "error", 'Error occurred while registering ' );
              redirect( 'register' );
        
            endif;
         
		
	}
}
