At 11:59 09-04-2004, John W. Holmes wrote:
From: "Ash.." <[EMAIL PROTECTED]>

> What are the various ways of forwarding to another page. I tried
header()..
> based on an example I found it in, but it doesnt work if I have done an
> include before calling the header. What are the other alternatives of
> forwarding. (I tried searching the PHP manual, but didnt find any clue.
Nor
> did I come across any learn material which seemed to deal with this.)

header() is the only way you're going to redirect with PHP. Alternatives
include a JavaScript redirection or a meta-refresh header.

I prefer having a meta-refresh header in my template. Since the template is shared across multiple scripts, some needs to forward, some don't I use a $forward variable that contains the URL to forward to, and simply check if it's set or not in the template header...


Something like:

<head>
<?php
if (isset($forward)) {
  echo("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=$forward\">\r\n");
}
?>
...
</head>

the \r\n is probably irrelevant in HTML headers, but force of habit from doing MIME headers...

naturally there's possible variation to this according to the actual project ... but it's how I do it ...


Rene


--
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to