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 |
Tell me what are magic methods?
What is php dependency injection?
Does php have a future?
What is the difference between Reply-to and Return-path in the headers of a mail function?
What is overloading in php?
Which function(s) in PHP computes the difference of arrays?
what are the differents between 'action' and 'target' in form tag?
What is the special meaning of __sleep and __wakeup?
What is session in php w3schools?
hi sir am kiran kumar finished my mca 2009 passed out sir .. i have more doubts regarding open source technologies sir if we pass zend exam in php can we get a job opportunity in foreign countries sir and is it good demand for php compared to dot net and java and some other technologies like sap , erp sir bcoz my friends saying they are finished dot net and java courses they telling in php we cannot earn more and we cannot go onsite opportunity even big companies not dealing with php is it right ah sir ? please send ur valuable suggestions to my email sir kiranpulsar2007@gmail.com please send ur phone number also sir thanking u sir
How many data types are used by php?
Who created numbers?