How can multiple variables be output on a single page using PHP sessions?

To output multiple variables on a single page using PHP sessions, you can store the variables in the session array and then access them on the page where you want to display them. This allows you to pass multiple variables between different pages without the need to use query strings or form submissions.

// Start the session
session_start();

// Store variables in the session
$_SESSION['variable1'] = 'Value 1';
$_SESSION['variable2'] = 'Value 2';

// Access the variables on the page where you want to display them
echo $_SESSION['variable1'];
echo $_SESSION['variable2'];