header("Location: https://example.com/newpage.php"); exit();
$id = $_GET['id']; if (!is_numeric($id)) { header("Location: https://example.com/error.php); exit(); } header("Location: https://example.com/user.php?id=$id"); exit();In this example, the code checks if the `id` parameter is numeric or not. If it is not numeric, the user is redirected to the error page. If it is numeric, the user is redirected to the user page with the `id` parameter. Package library: PHP has built-in methods to perform redirect, so no package/library needs to be used.