phpcodeignitercodeigniter-2codeigniter-datamappercodeigniter-form-helper

How to get parameter value in controller called using redirect function in codeigniter


I have started with codeingniter, I am calling controller using redirect() function with parameter, how can I get the parameter value in controller.php?

view.php

$para array(
             'id'=>$id, 'name'=>$name
);

redirect('login_controller/get_permissions/'.$para);    

I need $para value in controller.php, how can I get value of $para?

login_controller.php

   class Login_controller extends CI_Controller
   {
        function __construct()
        {
            parent::__construct();
        }

        function get_permission()
        {
            $get_para = $_GET['para'];
            echo $get_para;
        }
    }

it's not working :(


Solution

  • I have replaced this code:

    $para array(
             'id'=>$id, 'name'=>$name
      );
     $this->session->set_flashdata('para',$para);
    
    redirect('login_controller/get_permissions); 
    

    to

        $CI = get_instance();
        $CI->load->library('session');
    
        $para array(
                 'id'=>$id, 'name'=>$name
          );
    
        $CI->session->set_flashdata('para',$para);
    
        redirect('login_controller/get_permissions); 
    

    Its working now...