How to pass param to text input

I have this




<?php $questiontype = Yii::$app->getRequest()->getQueryParam('questype');?>



How do I pass the value of $questiontype into textinput()


<?= $form->field($model, 'qtype')->textInput(['maxlength' => 100]) ?>

  1. How do I pass the value of $questiontype into textinput()

  2. How do I rewrite the textinput()

I dont want anyone to type into the textinput

Hi folumike,




<?php $questiontype = Yii::$app->getRequest()->getQueryParam('questype');?>

<?php $model->qtype = $questiontype; ?>

<?= $form->field($model, 'qtype')->textInput(['maxlength' => 100, 'readOnly' => true]) ?>






<?= $form->field($model, 'qtype')->textInput(['maxlength' => 100, 'value' => $questiontype]) ?>