Re: Redirect
| From: | Ron Rudman | Date: | Sat, 05 Apr 2003 17:07:31 +0000 |
| Subject: | Re: Redirect | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142514@lists.php.net to get a copy of this message | ||
I believe you can also prevent the header error by using ob_start();
"Jean-Louis Letortorec" <JLeTortorec@healthcore.com> wrote in message
news:615315231286D21182E40008C7B1EED29FF56D@COMPAQ3000...
> To work around that "headers already sent" problem, I use:
>
> if ($condition == true) { echo
>
> "<script>location.href=('http://...');</script>";
> }
>
> That works great all the time (unless the javascript has been disabled at
> the browser side, but usually it's enabled).
>
>
> Jean-Louis
>
>
>
> At 15:55 3-4-2003, you wrote:
> >Hi,
> >
> >How would one redirect a user to a different page if a certain
> >condition was met?
> >
> >i.e.
> >
> >if($condition == true){
> > goTo newPage.php
> >}
>
> if ($condition == true)
> {
> Header("Location:
>
"http://www.sense.nl/index.php?module=ContentExpress&func=display&ceid=15");
> }
>
> take care that your script does not create any output before this,because
> then you will get an error (headers already sent)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php