S
S
Stepan2015-02-04 12:32:40
Yii
Stepan, 2015-02-04 12:32:40

Yii2 how to catch click on a specific button?

I have a form, it has 2 submit buttons
. Depending on which button the user pressed, I need to make an entry in the database.
That is, he clicked on one button, we put an additional flag in the database and save the form.
Clicked on another, just save the form without an additional flag.
So this is how to track click in php in yii2
How to implement it?
Not well with the button is clear. And then how to make changes to the database on click

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex stephen, 2015-02-04
@berezuev

Submit buttons also support a name value.
This value and focus

R
Roman Frank, 2015-02-04
@Akellacom

As Alexey Ukolov said above .
There will be something like $_POST['form_name']['button_name'] and, depending on the pressed button, set the flag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question