Ingolme Posted September 24, 2012 Share Posted September 24, 2012 The error message says that there is output, therefore there is obviously output somewhere. You better look more carefully at your code. Output can also include spaces and line breaks.It even tells you where the output occurred:output started at /home/content/31/9408631/html/....../index.php:2 Link to comment Share on other sites More sharing options...
westman Posted September 24, 2012 Author Share Posted September 24, 2012 i just opened a new folder and a new index.php in it with 1 line of code... <?php header("location: ../user/index.php?id=$id");?>and i got....Warning: Cannot modify header information - headers already sent by (output started at /home/content/31/9408631/html/testpage/index.php:2) in /home/content/31/9408631/html/testpage/index.php on line 3 how do i stop this error happening? Link to comment Share on other sites More sharing options...
Ingolme Posted September 24, 2012 Share Posted September 24, 2012 Go to index.php on line 2 and look for whatever is causing an output.Or post lines 1, 2 and 3 here so we can point it out. your header() function is on line 3, so there are two lines before it. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 24, 2012 Share Posted September 24, 2012 check for white space also, prolly have a space somewhere on index.php line 2, as foxy said. for me i normally check for the white spaces at the end of every closing, also from what i have experience echoing doesnt really bother the header(). its normally what donE's example show on the 1st page so on line 1 n 2 check for the spaces Link to comment Share on other sites More sharing options...
westman Posted September 24, 2012 Author Share Posted September 24, 2012 line1:<?phpline2:header("location: ../user/index.php?id=$id");line3:?> that's my index.php file only 3 lines of code and its not working. if i could get this small code working it would solve my header () problem Link to comment Share on other sites More sharing options...
thescientist Posted September 24, 2012 Share Posted September 24, 2012 (edited) it could be how you saved the file. Make sure when you are saving it, it is without BOM. Edited September 24, 2012 by thescientist Link to comment Share on other sites More sharing options...
westman Posted September 24, 2012 Author Share Posted September 24, 2012 i don't know what BOM is. i use DW to upload Link to comment Share on other sites More sharing options...
divinedesigns1 Posted September 24, 2012 Share Posted September 24, 2012 west copy your code in your file and paste it into the tags on here, we still cant see the problem since we cant view the codes Link to comment Share on other sites More sharing options...
westman Posted September 24, 2012 Author Share Posted September 24, 2012 <?php header("location: ../user/index.php?id=$id"); ?> this is an update now just 1 line of code Link to comment Share on other sites More sharing options...
thescientist Posted September 24, 2012 Share Posted September 24, 2012 i don't know what BOM is. i use DW to upload http://en.wikipedia.org/wiki/Byte_order_mark Link to comment Share on other sites More sharing options...
niche Posted September 24, 2012 Share Posted September 24, 2012 He obviously doesn't want to show us anymore of his code. DDs1 is at least the third person that's made that request. Hmmm. Link to comment Share on other sites More sharing options...
thescientist Posted September 24, 2012 Share Posted September 24, 2012 i don't think it's a code issue at this point. he is showing us the code that the error in the original post referenced. at this point it's probably how the file is being saved. Link to comment Share on other sites More sharing options...
niche Posted September 24, 2012 Share Posted September 24, 2012 Then I'd check the case of the file names including the directories. Link to comment Share on other sites More sharing options...
thescientist Posted September 24, 2012 Share Posted September 24, 2012 the issue as stated in the OP was that output has already been sent, and as such no location header can be sent. the issue now is to address where the output is coming from. If it was a path issue, the error would have made reference to not finding a page or something similar. Link to comment Share on other sites More sharing options...
Don E Posted September 24, 2012 Share Posted September 24, 2012 Glad that thescientist brought up the BOM. Lastnight after I left here, it came to mind and was reluctant to get back on and post about that. I had a similar problem with that, with the program I was using It was saving with BOM even though I specifically set it to save without BOM. Finally switching over to another editor and saving properly, it fixed the problem.With DW though, default settings from my understanding save UTF-8 without BOM, but I could be wrong. West, you might want to check the settings in DW. Link to comment Share on other sites More sharing options...
Ingolme Posted September 24, 2012 Share Posted September 24, 2012 The error message says your header() is one line 3 and the output started on line 2That means your code looks something like this:1.2. <?php3. header("location: ../user/index.php?id=$id");4. ?> Link to comment Share on other sites More sharing options...
westman Posted September 24, 2012 Author Share Posted September 24, 2012 my error is somthing i have never seen before. 1 simple line of code as you can see above in post 41 and am getting an error and i dont know why, so here is more info.... the 1 line code is on file index.php, the file is in www.mysite.com/testpage/index.php and i use godaddy for hosting is that helpful in finding the problem? Link to comment Share on other sites More sharing options...
Ingolme Posted September 24, 2012 Share Posted September 24, 2012 Just read the error message. If it's the same one as you posted before then it's the same problem as before. You probably have a line break on the first line. Link to comment Share on other sites More sharing options...
westman Posted September 25, 2012 Author Share Posted September 25, 2012 i got my new login working but i never found the problem.i fixed it by using an old login script and changing the code and layout bit by bit Link to comment Share on other sites More sharing options...
westman Posted September 25, 2012 Author Share Posted September 25, 2012 the problem came back and i did not do anything. no code was changed Link to comment Share on other sites More sharing options...
Ingolme Posted September 25, 2012 Share Posted September 25, 2012 Look for line breaks at the beginning of your code. Do you know what a line break is? Link to comment Share on other sites More sharing options...
westman Posted September 25, 2012 Author Share Posted September 25, 2012 no what is a link break and can you give an example please Link to comment Share on other sites More sharing options...
Ingolme Posted September 25, 2012 Share Posted September 25, 2012 "Line break" is the character that makes one line of text separated from another. It's like the <br> tag in HTML. It's invisible, but it's actually an output character like any other. If your <?php tag is not on the very first line of your document you are sending line breaks to the client, which is causing the headers to already be sent. Link to comment Share on other sites More sharing options...
westman Posted September 25, 2012 Author Share Posted September 25, 2012 hmm i see my code is all spread out like line 60 to 65 has no code, is that ok? Link to comment Share on other sites More sharing options...
westman Posted September 25, 2012 Author Share Posted September 25, 2012 omg i put <?php on line 1 and its working again i am so happy thank you so much so tell me is it ok if line 60 to 65 has no code? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now