header() problem - redirecting from an included script
Posted: Tue Jan 04, 2011 7:33 pm
Hi,
I'm trying to extend a site based around a very simple bespoke CMS that my friend has had set up for them. The way the site works is that there is just one main script (index.php) which loads content into different parts of a template depending on what the URL looks like, with all the content being retrieved from a database.
What I now need to do is add a bookings system to it that lets people reserve spaces on different types of events and how I've done this is by writing a new script (bookings.php) that gets included in the main script using require_once() if a specific URL is called.
I've now written the script and it all works correctly but I'm having a real problem redirecting the visitor to another page when the booking has been received (a PayPal payment page in fact) because the header() redirection has to be called from within the bookings script (bookings.php) but by this point the main script (index.php) has already started echo-ing out the page template.
Can anyone offer any suggestions as to how I could get the redirection working?
Thanks,
Mecha Godzilla
I'm trying to extend a site based around a very simple bespoke CMS that my friend has had set up for them. The way the site works is that there is just one main script (index.php) which loads content into different parts of a template depending on what the URL looks like, with all the content being retrieved from a database.
What I now need to do is add a bookings system to it that lets people reserve spaces on different types of events and how I've done this is by writing a new script (bookings.php) that gets included in the main script using require_once() if a specific URL is called.
I've now written the script and it all works correctly but I'm having a real problem redirecting the visitor to another page when the booking has been received (a PayPal payment page in fact) because the header() redirection has to be called from within the bookings script (bookings.php) but by this point the main script (index.php) has already started echo-ing out the page template.
Can anyone offer any suggestions as to how I could get the redirection working?
Thanks,
Mecha Godzilla