Page 1 of 1

Changing URL

Posted: Sun Feb 22, 2009 11:29 am
by roadkillguy
This is probably a very simple question, but how do I get another web page using php?

I have some code that executes some logic, and needs to get back to index.php when its done.

Are there any simple functions?

Re: Changing URL

Posted: Sun Feb 22, 2009 11:36 am
by watson516
You want to redirect?

Code: Select all

header('Location: index.php')

Re: Changing URL

Posted: Sun Feb 22, 2009 11:48 am
by roadkillguy
That doesn't seem to work. It gives a warning stating that php cant modify the header information because it was already sent.

Warning: Cannot modify header information - headers already sent by (output started at /home/david/public_html/PHP/Test.php:3) in /home/david/public_html/PHP/Test.php on line 19

Re: Changing URL

Posted: Sun Feb 22, 2009 1:54 pm
by watson516
that statement has to be at the top of the page before any output (including html). Or you could use ob_start() I hear.