Page 1 of 1

Redirecting

Posted: Wed Oct 30, 2002 11:56 am
by ChadEPop
Hi All,
I am a PHP newbie. For years I've been working with Microsoft technology. I'm currently working on a web app using PHP and MySQL. I'm quite embarrassed to say that I can't figure out how to redirect to other url's based. I've seen the Header() function but that only works at load time. I need to find something that works like the Redirect method of the Response object in ASP. That way, I can redirect users to different url's depending on what parameters are passed.

Thanks for helping out the new guy,
Chad

Posted: Wed Oct 30, 2002 12:00 pm
by volka

Code: Select all

<?php
switch ($_POSTї'mode'])
{
case 'eat':
   header('Location /eat.php');
   break;
case 'drink':
   header('Location /drink.php');
   break;
default:
   echo 'what?';
}?>

Posted: Thu Oct 31, 2002 10:08 am
by sinewave
I think he would like a way of redirecting after some output. As far as i know this cannot be done with php.

Posted: Thu Oct 31, 2002 10:24 am
by volka
like processing half of the page and then giving control to another script?
with ob_start() and include() this can be be (almost) done.
Apache sub-requests are also nice.