Php include forms or make functions of

Hi

I am building a small application and am learning the best way to make an easily maintainable / encapsulated form.

I am wondering is it best practice to make a “function” of the form or “include” it as a HTML include file.

As I repeat the same form through several scripts.

This is a subjective question, but I am wondering what a good quality website looks like (functionally programmed - my current skill set :frowning:

Any commentary on include files vs functions appreciated!

As really they seem to both produce the same outcome.

Thanks!
Karen

If you are going to use the form multiple times then just include it where needed.

Sure is this faster? Easier? More secure? Easier to manage long term?

Easier. In includes you can just use HTML, which is a lot easier to read than echo’ing out a bunch of HTML from a function.

Functions would probably be faster, but only marginally, and the loss of readability and maintainability is not worth it.

Security has nothing to do with it.

Great thx you two!!

Will do :slight_smile:

Karen

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.