In terms of best practices of PHP, is it better practice to write the processing script and the form in the same file or have them separate in different files? How does each scale in proportion to each other for larger projects?
For example, should I write it as:
Or should I write it as:
I've been trying to decide for a while between making it more abstract or more condensed... Is there a certain way that most web developers follow?
I think it is generally seen to be a better practice to separate them. Doing so gives you the added benefit of allowing you to guide alternate input routes into the same processor (making it more reusable).
as matter of fact for PHP there is no specific practice such as inline, internel or external you can adapt whichever you are comfortable with. for example for form you can use inline if fields are few. but if you see CMS (wordpress, etc.) file structure you will come to know. think on it see the difference
In terms if scaling it's much better to keep the business logic separate from the view as stated already. This makes things much easier to adapt at a later time and cope with change and expansion. This also allows for reusability.