What is the best practice for passing variables invisibly through URLs in PHP?

One common method for passing variables invisibly through URLs in PHP is to use session variables. By storing the variable in a session, it can be accessed across different pages without being visible in the URL. This is a more secure way to pass variables as it prevents users from tampering with the data in the URL.

<?php
session_start();

// Set the variable in the session
$_SESSION['variable_name'] = 'value';

// Access the variable on another page
$variable = $_SESSION['variable_name'];
?>