In some instances we need to set header information inside the <body> section.
E.g. Redirecting to other page according to a condition.
Example code:
It may gives a warning and code will stop at run time displaying a warning "Warning: Cannot modify header information - headers already sent by (output started at location) in /page on line xyz)"
Edit php.ini in your apache server and modify as "output_buffering = On"
To stop this warning and allow to add header information at to send header lines (including cookies) even after you send body content.
E.g. Redirecting to other page according to a condition.
Example code:
If ($a = "Yes")
header("location:ok.php");
It may gives a warning and code will stop at run time displaying a warning "Warning: Cannot modify header information - headers already sent by (output started at location) in /page on line xyz)"
Edit php.ini in your apache server and modify as "output_buffering = On"
To stop this warning and allow to add header information at to send header lines (including cookies) even after you send body content.