What does the error message "Cannot modify header information" indicate in PHP?

The error message "Cannot modify header information" in PHP indicates that there was an attempt to send HTTP headers after some content has already been output to the browser. This commonly occurs when there is whitespace or other output before the header() function is called. To solve this issue, make sure that there is no output (including whitespace) before calling the header() function.

<?php
ob_start(); // Start output buffering

// Your PHP code here

header('Location: new_page.php'); // Redirect to new page

ob_end_flush(); // Flush the output buffer
?>