What is the best practice for changing the content of a frame in PHP after a successful login?

After a successful login in PHP, the best practice for changing the content of a frame is to redirect the user to a new page or reload the current page with the updated content. This can be achieved by using header() function to redirect the user to a new page or by using JavaScript to reload the current page with the updated content.

// After successful login, redirect user to a new page
if ($login_successful) {
    header("Location: new_page.php");
    exit();
}

// After successful login, reload current page with updated content
if ($login_successful) {
    echo "<script>window.location.reload();</script>";
}