Answer the question
In order to leave comments, you need to log in
How to process form for page template (layouts/main.php)?
The form in the modal window should be used on all pages of the site, so we shove it into layouts.
The SiteController is used to process the form. The problem is that if it is in layouts/main.php , form processing through that controller is not done. If you push the form into site/index.php - everything works.
In uses, everything is the same, the problem is in processing.
As a matter of fact, as far as I understand, the form for the page template also needs to be processed in the SiteController and may not be rendered.
Answer the question
In order to leave comments, you need to log in
If the form works the same everywhere and does not send information that depends on the current content of the page, then it is better not to mention it in the controllers.
And send the data either (elegantly) with AJAX, or (hardcore) inside the form, pass the current URL and return to it after the form is processed. That is, you still need to write a controller for it, but one and independent.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question