In YII I could request a parameter from url and populate a form field called companyAdd_id
with the following code, trying to do the same in YII2 but getting errors, looking for advice on how to do the same in YII2. thanks
<?php echo $companyAdd_id = Yii::app()->request->getParam('companyAdd_id'); ?>
<?php echo $form->hiddenField($model, 'companyAdd_id', array(
'type' => 'text',
'value' => $companyAdd_id
)); ?>
<?php echo $form->error($model, 'companyAdd_id'); ?>
You can use the following code in Yii2:
Yii::$app->getRequest()->getQueryParam('companyAdd_id')
<?= Yii::$app->request->get('companyAdd_id') ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With