Hey guysI need your help

I have actionConsultar() in IncidenciaController that consult a DB (this is part of it)

      $chato=Incidencia:: findBySql($sql,[':munchen'=>$val])->all();



            $narco=  \app\models\Narcomenudeo::findBySql($sqlnm,[':munchen'=>$val])->all();

            $sec= Incidencia::findBySql($sqlsec,[':munchen'=>$val])->all();

            $rch= Incidencia::findBySql($sqlrch,[':munchen'=>$val])->all();




and returns

 return $this->render('consulta', ['model' => $model,'muns'=>$dataMunicipio,'val'=>$val,'chato'=>$chato,'mname'=>$mname,'viol'=>$violacion, 'hd'=>$hd,'narco'=>$narco,'sec'=>$sec, 'rch'=>$rch,'ran'=>$ran,'rat'=>$rat,'rdv'=>$rdv,'mes'=>$mes,]);

Then I have consulta view that shows the data in tables.

After that I have to export the data to pptx file.

What I want to know is how to send

$chato,$mname,$viol, $hd, $narco,$sec, $rch,$ran,$rat,$rdv,,

to ExcportController through a button from view. In order to process the information to be useful for phppresentation library.

My current code sends an Id to consult DB again. So Im getting the same data twice, once before view, once after view.

I want to avoid that. Do you know how i can make this process more eficient?

By tha way I have tried

<?=Html::a('Export', ['exportar/consultar', ['id'=>$val, 'incidencia'=>$chato,'mname'=>$mname,'viol'=>$viol, 'hd'=>$hd,'narco'=>$narco,'sec'=>$sec, 'rch'=>$rch,'ran'=>$ran,'rat'=>$rat,'rdv'=>$rdv,]], ['class' => 'btn btn-primary']);

But I get an error that says url is too long.


It is quite normal for a PHP application to have such a workflow. Usually you don’t need to (or, you can’t) avoid it.

Don’t try to pass heavy arrays/objects to another action directly. Pass only the id(s) of them and retrieve them again in the next round.

Thank you so much for answering. Thats what my current code does. I’ll keep it in mind to not do that in the future.