What are some best practices for passing variables between PHP pages without using $_GET?

When passing variables between PHP pages without using $_GET, one common method is to use sessions. Sessions allow you to store variables that can be accessed across multiple pages during a user's visit to a website. By setting session variables on one page and accessing them on another, you can pass data between pages securely without exposing it in the URL.

// Page 1: Setting a session variable
session_start();
$_SESSION['variable_name'] = 'value';

// Page 2: Accessing the session variable
session_start();
$passed_variable = $_SESSION['variable_name'];
echo $passed_variable;