dtrm_mora Posted November 24, 2009 Share Posted November 24, 2009 Hi,, I have read earlier posts regarding this.. but here is my problem. code: <?php header('Location: login.php'); ?> This is the only piece of code my in my page. There is no output here. But it gives a warning warning: Warning: Cannot modify header information - headers already sent by (output started at E:\Program Files\xampp\htdocs\cse\company-home-page.php:1) in E:\Program Files\xampp\htdocs\cse\company-home-page.php on line 3 company-home-page is the name of the page... What seems to be the problem.. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/ Share on other sites More sharing options...
Alex Posted November 24, 2009 Share Posted November 24, 2009 Make sure you remove any white-space before the php tags. Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/#findComment-964653 Share on other sites More sharing options...
Yesideez Posted November 24, 2009 Share Posted November 24, 2009 Have you read this??? http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/#findComment-964654 Share on other sites More sharing options...
dtrm_mora Posted November 24, 2009 Author Share Posted November 24, 2009 yes i have... here is the page that i want to handle.. Please help me with this.. " <?php session_start(); if($_SESSION['type']!="comp"){ header('Location: login.php'); } ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php //include('title.php');?></title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <div id="header"> <h1><strong><?php include('site_header.php');?> </strong></h1> <p><?php include('sub_header.php');?></p> </div> <!-- end header --> <!-- start page --> <div id="wrapper"> <div id="page"> <!-- start content --> <div id="content"> <?php $today=date("d-m-Y");?> <div class="post"> <h1 class="title">Company Home Page</h1> <p class="byline"><?php echo $today. " "; ?>Welcome - <?php echo $_SESSION['username']." ";?> | <a href="logout.php">logout</a></p> <div class="entry"> <p><strong>Black Eyed Susan </strong> is a free template from <a href="http://freecsstemplates.org/">Free CSS Templates</a> released under a <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>. The flower photo is fromt <a href="http://www.pdphoto.org/">PDPhoto.org</a>. You're free to use this template for both commercial or personal use. I only ask that you link back to <a href="http://freecsstemplates.org/">my site</a> in some way. Enjoy </p> <p> </p> <p>Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. Donec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. </p> </div> <p class="meta"><a href="#" class="more">Read More</a></p> </div> <div class="post"> <h2 class="title">Risus Pellentesque</h2> <p class="byline">Posted on August 25th, 2007 by <a href="#">admin</a> | <a href="#">Edit</a></p> <div class="entry"> <p>Maecenas pede nisl, elementum eu, ornare ac, malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. Donec condimentum, urna non molestie semper, ligula enim ornare nibh, quis laoreet eros quam eget ante. Maecenas pede nisl, elementum malesuada at, erat. Proin gravida orci porttitor enim accumsan lacinia. </p> </div> <p class="meta"><a href="#" class="more">Read More</a></p> </div> </div> <!-- end content --> <!-- start sidebar --> <div id="sidebar"> <ul> <li> <?php include('top_menu.php');?> </li> <li> <h2>Resources</h2> <ul> <?php include('resources_menu.php');?> </ul> </li> <li> <h2>Management</h2> <ul> <?php include('management_menu.php'); ?> </ul> </li> </ul> </div> <!-- end sidebar --> </div> <div style="clear:both"> </div> </div> <!-- end page --> <div id="footer"> <p><?php include('footer.php');?></p> </div> </body> </html> " thanks Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/#findComment-964655 Share on other sites More sharing options...
mraza Posted November 24, 2009 Share Posted November 24, 2009 there are two things in my mind you can try first clear your cookies it happens to me sometime before and when i cleared all goes well next better solution is to add ob_start(); at very top of your page before any thing, and ob_end_flush(); at very end of your file. Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/#findComment-964683 Share on other sites More sharing options...
PFMaBiSmAd Posted November 24, 2009 Share Posted November 24, 2009 Based on the line number where the error is occurring (line 3), you have at least one carriage-return/line-feed before the <?php tag. You cannot have any characters in your file before the <?php tag when you have a session_start() or a header() in your code. This includes, but is not limited to - a space, a tab, a carriage-return/line-feed, a doctype declaration, any other HTML, any other printing or non-printing characters, or the BOM (Byte Order Mark) characters that some editors place at the start of a file saved as UTF-8 format. Quote Link to comment https://forums.phpfreaks.com/topic/182771-header-problem-clarrification/#findComment-964708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.