yii add a hidden field in form

in views
hidden field with model and form:
<?php echo $form->hiddenField($model, 'name'); ?>

with value:

<?php echo $form->hiddenField($model, 'name', array('value'=>$value)); ?>

or without model

<?php echo CHtml::hiddenField('name' , 'value', array('id' => 'hiddenInput')); ?>

Leave a comment

Your email address will not be published. Required fields are marked *