What is this warning means?

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\free-prowebsite\site_pro\administrator\adminnav.php:160) in C:\xampp\htdocs\free-prowebsite\site_pro\administrator\admin\file-upload.php on line 224

line 224: header('Location: ' . SUCCESS_URL);

Recommended Answers

All 4 Replies

It means that you can't use the header() function to do a server redirect to a different page after already sending HTML data to the web browser.

Member Avatar for iamthwee

Often caused when you echo something before session start. You really should look at using a PHP framework. Most of your questions to date could greatly benefit from picking and spending a little time with a framework.

Member Avatar for diafol

cannot modify header

Glad to see you make use of the DW search function:

http://www.daniweb.com/search/query/17/threads?q=cannot+modify+header+site%3A%2A%2Fthreads+inurl%3Aweb-development+inurl%3Aphp#gsc.tab=0&gsc.q=cannot%20modify%20header%20site%3A*%2Fthreads%20inurl%3Aweb-development%20inurl%3Aphp&gsc.page=1

Here's a snip from Pritaeas' great 'read me' for this forum - take a look, it's really useful:

Before You Ask

...
* Engage your brain! We understand that running into a problem can turn off the rational centers of the brain, but please sit back and think for a bit about your problem before running off to find help. All too often a little common sense is all you need.
* Search the PHP manual. The PHP manual contains a lot of examples and comments, it is likely your issue has come up before. It is also likely there is a PHP manual in your own language, making it even easier.
* Search the forum. If you're having a problem, chances are good that someone else has had the same problem. Please search the forum for existing answers before starting a new thread. Nothing is more irritating to a long time member than answering the same question for the umpteenth time because someone didn't use the forum's search feature. See the section "Available Code Snippets" below, perhaps your question may be answered by one of them.
* Search the web. Even if the same question hasn't been asked on our forum, it may have been asked somewhere else on the web. Search engines are incredibly powerful, and they won't flame you about wasting their time if you ask a dumb question.

Before "running off and asking for help", search the PHP manual, search the DW forum, search the internet.

Member Avatar for diafol

I forgot to mention... in Pritaeas' post ( http://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question )

As he mentions:

Nothing is more irritating to a long time member than answering the same question for the umpteenth time because someone didn't use the forum's search feature. See the section "Available Code Snippets" below, perhaps your question may be answered by one of them.

And indeed...

Cannot modify header information - headers already sent

...is on the 'Available Code Snippet' list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.