On Wed, 04 Sep 2002 Ravindra Jaju wrote :
On Wed, Sep 04, 2002 at 12:50:01PM -0000, Amol Hatwar wrote:
Ahhh, see I'll make it sound simple - before any HTML is sent
to
the browser, the server dishes out headers to it. The 'Content-Type' and Content-Size is one example, cookies are another. However this process only happens once, that is to
say
you cannot send headers after you've sent the browser HTML.
So do your includes _before_ sending HTML and do not print or
echo
anything in the includes unless you obviously can't do with
out
it. Also for debugging, set variables rather than using
die().
Not too sure about this, but iirc, this changes with the newer version of PHP.
Output is buffered, so you can have headers anywhere.
Need to confirm though.
Nor am I... but I am sure sometimes scripts have to run with older versions of PHP. Server Admins resist installing something new just because its has one new cool-feature. Basically they are *drones*, but with PHP the reasons are good - major security flaws.
So its better to have headers before HTML. Your scripts stay portable.
Regards, -Amol Hatwar.