Answer the question
In order to leave comments, you need to log in
How to update data in Yii2 database?
There is a simple data entry form:
<div class="site-editdata">
<div class="row">
<div class="col-lg-5">
<?php $form = ActiveForm::begin(['id' => 'form-editdata']); ?>
<?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'area1') ?>
<?= $form->field($model, 'area2') ?>
<?= $form->field($model, 'area3') ?>
<?= $form->field($model, 'area4') ?>
<?= $form->field($model, 'area5') ?>
<?= $form->field($model, 'area6') ?>
<?= $form->field($model, 'area7') ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<div class="form-group">
<?= Html::submitButton('Edit', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
You need to update the corresponding cells in the table only if at least something is entered in the field.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question