-4

Possible Duplicate:
Headers already sent by PHP

When i use header( 'Location: index.php) in php code it display this error message.

Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\OnlineCode\online\survey\code\index.php:55) in D:\xampp\htdocs\OnlineCode\online\survey\code\index.php on line 62

how can i fixed this ?

Community
  • 1
  • 1
  • you have already sendet some outputs eg. some whitespace, header has to be sended before ANY output – Alex May 30 '12 at 07:23
  • 2
    Pedantic note: As per the HTTP specification, Location requires a full URL, not a relative path. Also, did you try to google this? This gets asked about every 10 minutes. – Corbin May 30 '12 at 07:25
  • sure duplicate: http://stackoverflow.com/questions/1827314/cannot-modify-header-information-headers-already-sent-why-its-happening and http://stackoverflow.com/questions/8028957/headers-already-sent-by-php – felixgaal May 30 '12 at 07:28

2 Answers2

4

make sure there is no echo or print statement before redirecting the header.It cause this error when we use echo or print before redirecting the header.

Pramod Kumar Sharma
  • 7,851
  • 5
  • 28
  • 53
0

This occurs when output has already been started. You have to put the header() calls before any output occurs. Even spaces outside of php tags count as output. It may be helpful to just post the page's code where we can look at it.

benprime
  • 76
  • 10