Radu033 Radu033 - 1 year ago 93
PHP Question

Codeigniter multiple controllers

I'm creating a todo list with registration. I named my default controller main and use it to

, on localhost the index page looks like
however, after logging in I don't want to show
but rather
do I have to create a new controller for that? Is it practical to use multiple controllers in CI?

now is

$route['default_controller'] = 'main';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Answer Source

  public function login_validation(){


     Little modification so that i'll come in this block if form has everything right in it 
    if($this->form_validation->run() !== FALSE){

      Also you should now check these user inputs against DB values to make sure if this user exists. you may use e.g 
       $result = $this->db->get_where('table_name',array('table_colum',$this->input->post('form_field_name')))->row();
        $data = array(
            'is_logged_in'=> 1

        // This should be the new controller where you want to take 
        // your user but by passing its ravelent data, you can do it like 

       //create new controller and put that name here for 'lists'
    } else {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download