Yii2 - hidden input value

You can create a hidden field in two ways

Method 1: inside active form
    
        <?php $form = ActiveForm::begin() ?>
        <?= $form->field($model, 'book')->hiddenInput(['value'=> $value])->label(false) ?>
        <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
        <?php ActiveForm::end() ?>
    
Method 2: with html helper
    
        <?= Html::hiddenInput('name', $value) ?>