What are the potential pitfalls of passing variables in a meta refresh URL in PHP?

Passing variables in a meta refresh URL in PHP can expose sensitive data and create security vulnerabilities, as the variables are visible in the URL. To solve this issue, you can use sessions to store and retrieve the variables securely without exposing them in the URL.

<?php
session_start();

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

// Redirect to the desired page
header('Location: page.php');
exit;
?>