What are the best practices for accessing form variables in PHP, considering the register_globals setting?

When the register_globals setting is enabled in PHP, form variables are automatically turned into global variables, which can lead to security vulnerabilities and unexpected behavior. To access form variables safely, it is recommended to use the $_GET, $_POST, or $_REQUEST superglobals instead of relying on register_globals.

// Accessing form variables safely without relying on register_globals
$variable = isset($_POST['variable']) ? $_POST['variable'] : '';