Entry
How can I redirect to another URL at any point of my PHP source? For example, using RESPONSE.BUFFER=TRUE at the header in ASP source, I can do that.
Jul 5th, 2002 20:53
Dan Christensen, Henrik Hansen, EAD Centro Universitário Feevale,
an example
if($bla == "true"){
Header("Location: new_url");
} else {
print("bla");
}
you can't use header if you print info before useing it
addition from opello:
you can also add
<?php ob_start(); ?>
to the top of your php page (tested in version 4.2.1)
then use header("Location: " . $url); wherever you want.
there are also other ob_ commands that go with this one, they may be
helpful, search the PHP manual / function and definition list