Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 2nd, 2003, 05:18 PM
Authorized User
Join Date: Jun 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot add header information....

Ok, here's another one to test your noodle. Here's the error.

Warning: Cannot add header information - headers already sent by (output started at /user1/****/www/editor/class/lang.class.php:134) in /user1/****/www/admin/edit_articles.php on line 165

Obviously this means that file1: lang.class.php is sending out header information. I want to simply use this to redirect the browser:

header("Location: edit_articles.php");

So how can I do this without removing file1? Any ideas? I know this is cheezy, but eberything I have read only explains how to start header output, not how to either start new header or append to the existing.

Old September 2nd, 2003, 07:02 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

If lang.class.php doesn't actually echo anything to the user (and, in my opinion, it shouldn't if it's just a class definition file), then look for whitespace outside of your <?php and ?> tags.

99% of all "Cannot add header info" errors are due to whitespace outside of the PHP delimiter tags. This whitespace is considered HTML by PHP, so if PHP encounters any, it'll send the default HTTP headers and begin the HTML document with that whitespace.

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
add extra header in datagrid p330418 ASP.NET 2.0 Professional 1 April 9th, 2008 10:30 AM
WordML - how to add custom information robbert XML 3 August 23rd, 2006 05:44 AM
HOw can i add Header and footer? NinaWilliam ASP.NET 1.0 and 1.1 Basics 0 April 25th, 2006 04:22 AM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM
PHP ( Cannot modify header information) squared_ring Beginning PHP 6 August 14th, 2004 05:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.