State problem: I want the browser to display a page that contains text content, menus that change the content, images, Google adsense ads and a subscription form. If the user fills in the subscription form and clicks Submit, the form's action is to return to the same page - where the php field validation code runs. Then comes the problem, because if the fields are all validated, I need then to re-direct the browser to a new page on a different domain (where resides an autoresponder) with a $url="http://newdomain/page?querystring".
The only URL re-direction I have been able to find in PHP is header(Location: $url). But this simply gives a "headers already sent" error if used as above. However, others have advised me that turning on output buffering will solve this.
I have a problem understanding this advice. Surely I would have to flush the buffer for the user to be able to see the page - and once I do that, the headers have already been sent. So if the user completed the form, my re-direction would fail with the "headers already sent" error.
Am I attempting the impossible in PHP? (If I were on a Windows server with ASP, it would be so easy - response.redirect(url) and the job's done!)
If I'm stupid, tell it to me how it is.....