SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with header() function

    whenever i'm using header('Location: URL'); function an error message as follows appears:

    Warning: Cannot modify header information - headers already sent by(... )

    Please help.

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cross browser css bugs

    Dan Schulz you will be missed

  3. #3
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't output anything to the browser and then send a header.
    Output could be echo, print, or HTML not in a PHP block, or even white space before you open a PHP block.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot soulscratch..
    when i followed the link u gave, the problem was solved.
    i had saved the php file as UTF-8 in notepad. when i changed it to ANSI that error was solved.
    but i thought saving the php file as UTF-8 was good. But only when i changed it to ANSI the problem was solved...
    please help with this

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,603
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Sounds like when you have it set to UTF-8 that you are writing ot the byte order mark before doing anything else. That counts as output to the web page and has to come after any headers.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Tags for this Thread

Bookmarks

Posting Permissions

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