SirChick Posted January 7, 2008 Share Posted January 7, 2008 Ok this is a bad problem as I just converting my site to CSS. Now for validation i always header away users.. but now cos i have this: <?php include css1 file //php stuff header("page etc etc "); include css2 file ?> I am obviously now getting: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\css\layout1.php:142) in C:\xampp\htdocs\myitems.php on line 179 There must be a work around to this!? Obviously CSS is going to happen first before the php. Between the two files the php is in a column of the CSS so i have to split it like that... so does this mean i can now only print errors and never header people away? Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/ Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 use a if condition or in bad pratice use ob_start() and ob_flush() at the end off the page Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/#findComment-432302 Share on other sites More sharing options...
SirChick Posted January 7, 2008 Author Share Posted January 7, 2008 Wait i am using an if condition ..its basically if the $_GET is wrong it has this at the very end: }Else{ Header the page } No content is shown from the php outside an IF statement. But the CSS is. So what does ob_start() and ob_flush() do? And why is it bad practice? Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/#findComment-432304 Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 try it m8 it clar's buffers letting u use the header function on a page catched........ Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/#findComment-432313 Share on other sites More sharing options...
SirChick Posted January 7, 2008 Author Share Posted January 7, 2008 I put them both at the bottom of the page but nothing happens. Same error occurs i mean. Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/#findComment-432342 Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 post current code please? Link to comment https://forums.phpfreaks.com/topic/84800-big-problem-with-headers/#findComment-432343 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.