Call Another Controller Actions With Params

In my Controller A

class Controller A extends Controller


{





    public function action save()


    {


       $array1 = $_POST['array'];


           $A = $this->redirect(array('controller B/insert','data'=>$array1));


           echo $a;


    }


}





controller B





class Controller B extends Controller


{


    public function action Insert($data)


    {


        echo $data;


        /*----code-----*/


        return value;


    }








}





I am newbie in yii framework. I have problem with, call controller b action Insert() from controller a with parameters. But I have error like "400 Your request is invalid.". I don't know  how to fix it. please help me anyone to correct my code..! Sorry for my English.. Thank You..

Your $data is a $_POST array, I wonder how many troubles will you get here. Seems like a very bad design for me.

PS. "400 Bad Request" is caused also by mismatching action params and actually passed params. Check the generated URL.

If you want to pass an array as an action parameter you need to type hint it in the action definition:




public function actionSomething(array $data)

{

}



It will allow passing arrays and non arrays will be converted to array with one element.