how to do response.redirect (as in asp) in php4?

let say i have this condition:

...
<!-- some HTML stuffs here -->

<?php
...
if (ok) {
      //do response.redirect to URL a
}
else {
      //response.redirect to URL b instead.
}
...
?>
how can i achieve  my requirement?

thanks in advance.
wkwooAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gravityCommented:
<?
if (condition )
Header("Location:http://myurl.com/");
else
Header("Location:http://otherurl.com");

?>

The only thing is that this *must* be at the top of the page, nothing can be sent to the browser before this, no HTML, nothing ;)
0
freshmeatCommented:
can i send some params in the header?
such as:
Header("Location:http://myurl.com/test.php3?param1=value1¶m2=value2");

:)

0
maxkirCommented:
To freshmeat:
 Yes, you can.
 
 One impotant note:

 You can use Header() function only before any output from your php-script.
regards,
 KIR
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

wkwooAuthor Commented:
Edited text of question.
0
wkwooAuthor Commented:
Adjusted points to 60
0
ilia239Commented:
function Redirect ($url)
{
    Header("HTTP/1.0 302 Redirect");
    Header("Location: $url");
    exit;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gravityCommented:
ilia239 > Quite what is the difference between your answer and my comment ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.