There is a third way, which I especially love. To separate the logic from the presentation, I like to include a PHP file in every HTML document that requires some kind of processing (for example, displaying dynamic data, processing HTTP POST requests, etc.). I usually keep this file in a separate directory and name it "filename.page.php". Needless to say, this is nothing more than a coding convention, and you can call it something else.
In a sense, this means that you are processing the HTTP POST request in the same file (at least as far as your web server). You can redirect clients anyway using the HTTP Location header as follows:
header("Location: file.php")
As a side note, I will not depend on HTTP POST for security; it's no harder to do arbitrary HTTP POST requests than HTTP GET requests.
source share