I have this code
enter <div class="formularz">
<div class="row">
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
<div class="col-md-6">
<?php echo $form->field($model, 'name')->label('Imię i nazwisko')?>
</div>
<div class="col-md-6">
<?php echo $form->field($model, 'email')->label('Adres email') ?>
</div>
<div class="col-md-6">
<?php echo $form->field($model, 'phone')->label('Telefon') ?>
</div> here
How can i get in this inputs values of actualy logged user for example i refresh page and i want to have filled inputs with some data.
I take you're using Yii
. Here is the documentation of what you're asking:
http://www.yiiframework.com/doc-2.0/yii-bootstrap-activeform.html#field%28%29-detail
Just add any attribute you want inside an array and plug it in as the third parameter of the field
method.
<?php echo $form->field($model, 'email', ['inputOptions' => ['value' => 'my Value']])->label('Adres email') ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.