Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Php Header Help


Pilpest
 Share

Recommended Posts

So this may seem easy to people who know about PHP more then I, but I've not been able to figure it out even though everyone else is telling me to remove spaces, except IDK where.

 

Heres the error I get-

Warning: Cannot modify header information - headers already sent by (output started at *\modules\navbar.php:110) in *\modules\admin.php on line 115.

 

 

Ignore the * as that is just deleting the extra stuff...

Now for the code... Posted in pastebin.com

 

Navbar PHP

--------------------------------------------------------

Admin PHP

Edited by Pilpest
Link to comment
Share on other sites

Line 110 in navbar.php you tell it to call HEADER again after you've sent your HTML

same with line 115 in admin.php

 

At least that's what I think it is because you closed the PHP and reopened it AFTER the fact with a (HEADER) redirect. If my memory serves, that doesn't fly with PHP. Header cannot be sent AFTER you've sent content/data over.

 

I guess you could use ob_start if it's that important for you to have it that way but I mean you are increasing memory and cpu loads (maybe not that much though xD).

Link to comment
Share on other sites

Guest The_Monkey

Your code worked on my box.

 

Try reversing your if statement so that the first statement is the header change. As Enigma stated, outputting crap outside of php tags can cause the buffer to be sent. As such, you cannot modify the headers. Use ob_start too, again as Enigma suggested.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share