when you will get the message/error "headers already sent"?
Answers were Sorted based on User's Feedback
Answer / luan nguyen
you get header already sent when you call header() after you
have posted other data to the browsers.
Example:
<?php
echo "Hello World";
header("Location: http://new.url.com");
?>
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / suren
if u print any message on the browser using echo statement
or any html tags before using the "session_start()" like
statements in the scripts.
if u want to overcome that problem
simply write "ob_start();" at the very starting of script
and "ob_end_flush();" at the end.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / vishwanath
php have header_sent() function to check the headers are
sent or not
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / shiva
This is due to whitespaces before php tags you are leaving
at the starting of the line.
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / dhiraj
when we are using the session variable..and want to start
our session.. we use session_start(); in the very first
line.
anything occur before this line, even a single space we get
the headers already sent error.
To overcome this problem, we can use ob_start(); at the
very first line and ob_end_flush(); at the end of the
script..
| Is This Answer Correct ? | 1 Yes | 1 No |
What types of images that PHP supports?
How to restrict the number of users login ? For ex:- if the allowed login is 10, for 11th user, the application should restrict them from login.
What is mysql_fetch_object?
What is properties of class?
Explain me is multiple inheritance supported in php?
What is a trait in php?
What changes to done in PHP.ini file for file uploading?
Why do we use php?
Explain me what is the goto statement useful for?
hi, i have knowledge about PHP/MYSQL,i am fresher of M.Sc-IT 2009 pass out,any recruitment in PHP please let me know.my email id:nathiyasms@gmail.com
What are the two types of variables?
What are the 3 types of sessions?