How to bind a button to the function public function delete() . It is necessary that the button from view\welcom_messege be bound to the function public function delete() from controllers\Welcom.

    1 answer 1

    If I understand you correctly, then it should be a form submit button and the form itself should be sent to the appropriate action delete.

    Without knowing the structure of your URL I won’t say exactly, but something like this

     <? $form = ActiveForm::begin(['action' =>['post/delete'],'method' => 'post',]); ?> <?= $form->field($model, 'post_id') ?> <?= Html::submitButton('Удалить') ?> <? ActiveForm::end(); ?>