Jump to content

Big problem with headers!


SirChick

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.