Button passing value

hi guys i’m creating this button in a grid

<?php Pjax::begin(); ?>
     <?= GridView::widget([
    'dataProvider' => $provider,
     'columns' => [
        
        'Modello',
        'Tessuto',
        'Colore',
         // ['class' => 'yii\grid\CheckboxColumn','header'=>'sel'], 
         [
        'label' => 'Vai Dettaglio',
        'format' => 'raw',
        'content' =>function($provider,$mg) { 
         return Html::a($provider['Modello'].'-'.$provider['Colore'].'-'.$provider['Tessuto'].'-'.xmg,
                 ['dett', ['mg'=>xmg,'rows'=>$provider]], ['class' => 'btn btn-success btn-xs']
                 );
        
        }
    ]
  ]
]); ?>
<?php Pjax::end(); ?>

in the controller i have this code

public function actionDett($rows,$mg ){
//, [“rows”=>$rows,“mg”=>$mg]
return $this->render(‘dett’,[“rows”=>$rows,“mg”=>$mg]);
}

so any time i click on the button i get 400 error

Bad Request (#400)

Missing required parameters: rows, mg

i have check $rows has data and xmg is a constant with a value…
where is the error?

i have see at the url level it is
index.php?r=tabmagazzini%2Fdett&1%5Bmg%5D=mag01&1%5Brows%5D%5BModello%5D=01025&1%5Brows%5D%5BColore%5D=001&1%5Brows%5D%5BTessuto%5D=7O

the url shouldnt have & and not 1%5B ?

tks all

See Creating Url

Html::a($provider['Modello'].'-'.$provider['Colore'].'-'.$provider['Tessuto'].'-'.xmg,
     ['dett', 'mg'=>xmg,'rows'=>$provider],
     ['class' => 'btn btn-success btn-xs']
);
1 Like

tks a lot!!