Jump to content

[SOLVED] headers already sent - I did read the postings but still happening


sophielulu

Recommended Posts

Please Help!!!

 

here is my entire file

<?php ob_start(); setcookie('username', 'admin'); ?>

 

I get the headers already sent message.

Warning: Cannot modify header information - headers already sent by (output started at /home/content/s/o/p/sophielulu/html/csc401/class/setcookie.php:1) in /home/content/s/o/p/sophielulu/html/csc401/class/setcookie.php on line 1

 

 

I have read the postings and nothing is being sent before this line and I've added the ob_start().  Not sure what to try next........

That should work. Sometimes whatever editor you're using puts an unprintable character before the initial "<?php" which will cause this problem. Retype everything into a new file.

 

Also, instead of putting everything on one line, make multiple lines:

<?php
ob_start();
setcookie('username', 'admin');
?>

 

This way the error message might actually point to the correct line.

 

 

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.