w1ww Posted December 10, 2007 Share Posted December 10, 2007 Hello. I searched google and found that the headers already sent problem error is returned if theres a white space. Still, on my script there's nothing on the first line. <?php ob_start(); $inTwoMonths = 60 * 60 * 24 * 60 + time(); setcookie('lastVisit', date("Y-m-d G:m:s"), $inTwoMonths); ob_end_flush(); //show form if (!isset($_POST['sub'])){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <head><title>Ajuntamento do Pandalho</title> This are the first lines of my script. Why do I keep getting "Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\pandalho\index.php:1) in D:\wamp\www\testing\index.php on line 5" Thank you. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 10, 2007 Share Posted December 10, 2007 The cause of the error is on line 1 in D:\wamp\www\pandalho\index.php. The error was returned from D:\wamp\www\testing\index.php on line 5 What is on line 1 in D:\wamp\www\pandalho\index.php? <<< That is the file that is causing the error. Quote Link to comment Share on other sites More sharing options...
w1ww Posted December 10, 2007 Author Share Posted December 10, 2007 Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\pandalho\index.php:1) in D:\wamp\www\pandalho\index.php on line 5 This is the right error. Sorry. In the first line there is a single <?php tag without any spaces! Thank you! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 10, 2007 Share Posted December 10, 2007 How was the file created? Your text editor maybe the cause. Try creating it with just notepad. Note: When saving with notepad make sure you go to File > Save As... and that the File Type pull down menu is set to All Files and the Encoding is set to ANSI. Quote Link to comment Share on other sites More sharing options...
w1ww Posted December 10, 2007 Author Share Posted December 10, 2007 That was the problem! I was coding with dreamweaver. Thanks a lot! Quote Link to comment 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.