Just done something similar - redirected to the same page with different parameters if a particular parameter was set. I use JSPs though, but the principle should be fairly similar - they don't allow you to redirect after you've done any output at all, so you must make your decision first, before outputting anything. This means using a separate pure PHP page as the target. Then, if you find all's well, redirect to success.htm, otherwise redirect to mypage.htm.
You could rewrite mypage.htm as php, but I don't totally approve of mixing content and programmatical data in the same file. Easier to debug if you keep it separate.