There is nothing wrong with starting out with a single file containing all code if the project is very small. Surfer513 has pointed to a good article explaining n-Tier architecture. How do you get from where you are to there?
The answer to that is refactoring. Once you get to the point where a single file becomes clumsy or unmanageable, you need to start separating it into pieces. There is a very good book on refactoring from Martin Fowler. That book is mostly concerned with object oriented programming, but the principles apply all the same.
The first step is often to separate the display from the rest. In the language of MVC, the display code is the view (in a web application in PHP, these could be HTML templates and CSS). For PHP applications you can use a templating engine such as smarty.
The next step is often to separate the actual business logic from the data access layer. This is generally also a good time to start thinking about using OOP (if your code isn't already using it), since this allows for easy grouping of functionality that belongs together and separating it from other functionality, plus code reuse.
After that you will probably have a good idea what the next steps should be. This is not a "one size fits all" situation, every project has to develop its own structure and architecture over time, depending on its particular needs.