...

View Full Version : header? How?



kab_184
11-27-2003, 01:54 PM
hi

i have a it problem with including file

when ever i include a file within a page its says


warning cannot modify header .header already sent..



how come?i didnt submitted any data..the file i included is collecting data form the visitor..


is it related to the location of the inclusion code ?i included the code at the tenth line on the page.

anyone?

SDP2006
11-27-2003, 01:57 PM
You must have the headers sent before any HTML. Even the smallest little bit of text. It must come before everything. If its a file sending headers, that is. Any other files, its okay where you put them. i.e
<hr noshade color="black" size="1">
<?php include('file.php'); /*This file sends headers*/ ?>

That will not work. This will
<?php include('file.php'); /*this file sends headers*/ ?>
<hr noshade color="black" size="1">

that will work.

Hope this helps.

Nightfire
11-27-2003, 03:07 PM
You can include files where ever you want to...

If the included file has something like a session, cookie or header, it needs to be before anything is outputted to the browser. This could be white space, or html.

wox3-iO
11-28-2003, 11:41 AM
Just curious, what will happen if I don't send the header before the html?

Nightfire
11-28-2003, 01:36 PM
Then you'd get the error:

warning cannot modify header .header already sent.. etc



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum