Doubt PHP Form [closed]

1

Hello to the whole community, I have a simple doubt, what is better to put the PHP code of a form within the same form or create another file where is the PHP code that will process the form?

    
asked by Pyter 25.10.2016 в 06:59
source

3 answers

3

According to the recommendations of php style , the correct thing to do is to keep, so to speak, the separate logic of the views. Therefore, it is better to keep the form separate from the code that processes it. You can read this and other recommendations here: link

    
answered by 25.10.2016 в 08:54
2

As you have been told by pure organization, it is better to keep them in different files.

Imagine that you need to modify some of the PHP logic, it is easier to read the code in a single PHP file than in one where the whole HTML & PHP.

In addition to correcting incidents in the code, it is also advisable to have it separated.

But it may be that for convenience, it may be better for you to have it all in one, so there is no black and white answer in this matter either.

    
answered by 25.10.2016 в 08:27
0

For me it is much better to separate the server part (php) with the client part (the form). Why? If you separate the logic on the one hand (php) of the presentation (html) it is much easier to maintain the code than if you have it all together. In addition, it is much easier to read the code.

    
answered by 25.10.2016 в 08:03