What common mistake is the user making when using the header() function in PHP?
The common mistake the user is making when using the header() function in PHP is that they are outputting content before calling the header() function. The header() function must be called before any output is sent to the browser, including whitespace. To solve this issue, make sure to call the header() function before any other content is echoed or printed to the browser.
<?php
// Correct way to use header() function
header("Location: https://www.example.com");
exit;
?>