B
B
bpGusar2017-08-19 19:39:59
Laravel
bpGusar, 2017-08-19 19:39:59

How in Laravel for each button in the view to specify a different function in the controller?

How in Laravel for each button in the view to specify a different function in the controller?
For example, there are 3 input fields and each has a different button with different functions

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Melikhov, 2017-08-19
@amelihovv

The form these inputs are in can only be submitted to one address. Therefore, to do what you want, you need to process the form in one controller function. And you can perform different actions depending on which input was pressed by the name of this input. If there are three inputs named input1, input2, input3 with type=submit. Then when you click on the second input, in the request, the input2 value will be present in the request data, but input1 and input3 will not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question