How can PHP beginners create links that load new pages on click without using frames?

PHP beginners can create links that load new pages on click by using the header() function to redirect the user to the desired page. This can be achieved by setting the location header to the URL of the new page. By doing this, the user will be redirected to the new page when they click on the link.

<?php
if(isset($_POST['submit'])){
    $newPage = $_POST['page'];
    header("Location: $newPage");
    exit();
}
?>

<form method="post">
    <input type="hidden" name="page" value="newpage.php">
    <button type="submit" name="submit">Go to new page</button>
</form>