How does the PHP header function work in the context of page redirection?
When using the PHP `header` function for page redirection, you need to make sure that no output is sent to the browser before calling the function. This is because the `header` function sends an HTTP header to the browser, and if any content has already been sent, it will cause an error. To redirect a user to a different page, you can use the `header('Location: new_page.php');` syntax.
<?php
// Ensure no output has been sent
ob_start();
// Redirect to a new page
header('Location: new_page.php');
exit;
?>