Forum Moderators: coopster

Message Too Old, No Replies

Execute PHP code then redirect to another page

         

freddo9

9:14 pm on Jun 17, 2006 (gmt 0)

10+ Year Member



I have a php page executing some code. When the code has finished I want it to redirect to another page.

If I use
php code ....
then
header("location: new page");
The page redirects straight away without executing the code first.

THanks freddo

dreamcatcher

10:47 pm on Jun 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



freddo9, a warm welcome to Webmaster World. :)

Can you post some more of your code, so we can see what it is you are trying to achieve?

dc

freddo9

12:51 am on Jun 18, 2006 (gmt 0)

10+ Year Member



Hi Dreamcatcher

The php code opens and reads the contents of a text file then writes it with changes to another file.

When this is done I want to immediately open another web page closing the current one.

Freddo9

dreamcatcher

8:35 am on Jun 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, the header function should do the trick if you are using it correctly. ie, before any other output to your browser.

Try popping the following at the top of your script to see if it throws any errors:

error_reporting(E_ALL);

dc

freddo

7:59 am on Jun 22, 2006 (gmt 0)

10+ Year Member



Sorted it out thanks.

Freddo