Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: header? How?

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    header???how

    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?
    Move on....

  • #2
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    PHP Code:
    <hr noshade color="black" size="1">
    <?php include('file.php'); /*This file sends headers*/ ?>
    That will not work. This will
    PHP Code:
    <?php include('file.php'); /*this file sends headers*/ ?>
    <hr noshade color="black" size="1">
    that will work.

    Hope this helps.
    Last edited by SDP2006; 11-27-2003 at 02:00 PM.
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Feb 2003
    Location
    Helsinki, Finland
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just curious, what will happen if I don't send the header before the html?

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Then you'd get the error:

    warning cannot modify header .header already sent.. etc


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •