Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Ismail Qaznili
Ismail Qaznili
27,996 Points

Single File Form Submission VS Multi File Form Sumission: More Than One form on the Website

Hello!

I was wondering in the case a website would contain multiple form for different purposes let's say; different application forms for different courses.

Should I use a single contact.php file (containing from submission and result messages) for each form or I should use the three file structure?

Which is the best common practice?

1 Answer

It depends how similar the forms are. If they look exactly the same to the user and the only differences are values of hidden input fields, then use the same file and dynamically change the hidden data. If they are completely different from each other then use different files

Ismail Qaznili
Ismail Qaznili
27,996 Points

Thanks James! I was thinking about a lot recently and I like your insight. I will keep it in mind for future projects. Bests.