Re: Whats the "php" way of redirecting to a new .php file please?
| From: | Jon Parise | Date: | Sat, 26 Aug 2000 18:06:17 +0000 |
| Subject: | Re: Whats the "php" way of redirecting to a new .php file please? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13801@lists.php.net to get a copy of this message | ||
On Sat, Aug 26, 2000 at 07:05:57PM +0100, James Moore wrote:
> > Say I'm in one .php file and I know when a certain test is true I
> > just want to get out and load another file, just like the user had
> > clicked an <a href> or clicked the submit button of a <form>. Whats
> > the smart way to do it please?
>
> <?php
> if ($thevalue == "Go")
> {
> header("Location: newpage.php");
> }
> ?>
>
> This must be before any output.
That should also include the full URL to the new file, so something
like this is in order (to meet the spec):
header("Location: http://$HTTP_HOST/newpage.php");
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House
Member