Results 1 to 3 of 3

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

  1. #1

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    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

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    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 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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 FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

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



Click Here to Expand Forum to Full Width