K
K
KiselevPD2015-10-17 21:30:57
PHP
KiselevPD, 2015-10-17 21:30:57

PHP. How to make form and handler in one file?

Hello. I am slowly improving my knowledge of PHP.
Asked a question.
For example, we have /guestbook/form.php/ In which there is a form with fields "Login, Text".
How to make this form handler in the same file? In what ways?
A native question, but I don’t even know how to ask Google about it.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GDApsy, 2015-10-17
@KiselevPD

It’s probably better to just separate everything normally, based on the MVC pattern, to avoid mess, but you can also write in the action the form parameter the path to the same PHP script that created the form, and then, based on the request type, determine which part run code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question