Results 1 to 3 of 3

Thread: [RESOLVED] PHP: Header Code Not Work When Website is Uploaded

  1. #1
    Hyperactive Member louvelle's Avatar
    Join Date
    Jun 08
    Posts
    464

    Resolved [RESOLVED] PHP: Header Code Not Work When Website is Uploaded

    Hi guys.

    I get this error:
    Warning: Cannot modify header information - headers already sent by (output started at /home/janrapha/public_html/UpdateToday/includes/overall/header.php:7) in /home/janrapha/public_html/UpdateToday/register.php on line 116
    line 116 is this code.
    Code:
    header('location: register.php?success');
    I got no error when I'm running the site in my localhost. But when I upload the files online, I got errors saying headers are already sent.
    Please help.

    Manny Pacquiao once posted in his twitter:
    It doesn't matter if the grammar is wrong, what matter is that you get the message

  2. #2
    Hyperactive Member louvelle's Avatar
    Join Date
    Jun 08
    Posts
    464

    Re: PHP: Header Code Not Work When Website is Uploaded

    I've decided to replace the php code:
    Code:
    header('location: register.php?success');
    with a javascript code:
    Code:
    <script type="text/javascript">
    <!--
    window.location = "http://www.google.com/"
    //-->
    </script>
    Problem solve

    Manny Pacquiao once posted in his twitter:
    It doesn't matter if the grammar is wrong, what matter is that you get the message

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 08
    Location
    Trivandrum, Kerala, India
    Posts
    7,557

    Re: [RESOLVED] PHP: Header Code Not Work When Website is Uploaded

    You are supposed to use the header function before echoing anything on the page. Means it should be used before the output.

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
    Read more in here: http://php.net/manual/en/function.header.php


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD Athlon X2 5200+, ASUS Motherboard, 2 GB RAM, 400 GB HDD, Nvidia 8600 GT 512MB, 19.5" TFT(Wide), Creative 5.1 Home Theater

    Social Group: VBForums - Developers from India

    Skills: PHP, MySQL, jQuery, VB.Net, VB6, Photoshop...

Posting Permissions

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