Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

 
 header function error: Warning: Cannot modify header information
Author:  (---.txucom.net)
Date:   01-08-04 21:14

Hi,
I am trying to use a form for a guestbook script to store the information into a database and then once the user clicks submit, it will take them back to the entries. My problem is that when I run the script I get this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/rottedha/public_html/guestbook.php:5) in /home/rottedha/public_html/guestbook.php on line 201

Lines 200 and 201 look like this:

Line 200: $ref = $_SERVER['HTTP_REFERER'];
Line 201: header ("Location: $ref");

I can't seem to find out why this is happening. If someone could help I would greatly appreciate it.

Thanks!

 Re: header function error: Warning: Cannot modify header information
Author:  (---.ym.rnc.net.cable.rogers.com)
Date:   01-09-04 06:38

you have shown all your code, but its most likely that you have either sent some html code to the browser (like "") or that there is a blank line above one of the "
check for both of those.

 Re: header function error: Warning: Cannot modify header information
Author:  (---.80-202-209.nextgentel.com)
Date:   01-09-04 08:03

It's because you have allready sent some data to the browser before line 201, I don't know what you have sent because you only wrote those two lines, but I suggest you remove it, or put it after line 201. But since you are redirecting to another page, you could remove it anyway..
You cannot send any data before the header() function, not even or something like that.. ;)

Fredrik Hugås

 Re: header function error: Warning: Cannot modify header information
Author:  (61.1.204.---)
Date:   01-30-04 08:00

I came here thro Googling for this error...
AND WOW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thanks to Bastien, got it solved.
There was indeed a empty line right on the top.
Thanks Bastien. THanks a ton!
THe Internet survives becoz of Guys like you still logging in.

 Re: header function error: Warning: Cannot modify header information
Author:  (---.dialup.mindspring.com)
Date:   02-19-04 11:42

just like Jagan Mohan, i googled for the error, read bastion and jake's replys and found a blank line at the top of my php file.

thanks folks.

 Re: header function error: Warning: Cannot modify header information
Author: Emanuel (217.129.151.---)
Date:   02-20-04 06:08

Me to! Got the problem solved just like that :D

Tks

 Re: header function error: Warning: Cannot modify header information
Author: Balaheler (---.ph.ph.cox.net)
Date:   02-20-04 19:55

blank line! Fixed the problem

 Re: header function error: Warning: Cannot modify header information
Author: korn23 (---.dclient.hispeed.ch)
Date:   02-23-04 17:31

Hate to say this, but it solved my Prob too.


Great.

Many Thanks =)

 Re: header function error: Warning: Cannot modify header information
Author: Aristo (---.roburnet.sk)
Date:   03-06-04 02:00

tnx a lot
i have one space at end of including other source code :|

ufff Jagan Mohan wrote:

Go to Top  |  Go to Topic  |  Threaded View  |  Search 
  |  
New Topic
 Reply To This Message
 Your Name:
 Your Email:
 Subject:
Email replies to this thread, to the address above.
  

Provided By
Phorum