|
Posted by Oli Filth on 11/15/05 21:12
John said the following on 15/11/2005 19:01:
> On 15 Nov 2005 05:21:35 -0800, "Oli Filth" <catch@olifilth.co.uk>
> wrote:
>
>>
>>===== VERY TOP OF FILE =====
>>1:
>>2: <?php
>>3: /* some code here */
>>4: ?>
>>5:
>>6: <?php header("Location: $page"); ?>
>>...
>>
>>The blank lines on lines 1 and 5 would cause header not to work.
>>
>>The following would also cause a problem:
>>
>>===== VERY TOP OF FILE =====
>>1: <HTML>
>>2: <?php header("Location: $page"); ?>
>
>
> The code is situated towards the end of a web page with the usual tags
> -
>
> <HTML>
> <HEAD>
> title, and other paraphernalia
> includes for style sheets
> </HEAD>
> <BODY>
> include files for menus for the page
> html to capture form information
> and php processing to do the jump
> </HTM>
>
> are you saying the code to do the jump must be the very first thing in
> file and that's it?
No...
header() must be used *before* all script *output*. You can do as much
PHP processing as you like, as long as nothing is output before header()
is used, e.g. echo(), print(), characters outside <?php...?>.
I'm sure this is what it pretty much said in any of the references that
Philip (rather unsubtly) pointed you toward... ;)
--
Oli
[Back to original message]
|