I am trying to pass some variable from a PHP module (Sourcerer) to custom PHP script using Sessions method (as posted here (https://stackoverflow.com/a/16778482/3565182)). The method works fine between two PHP scripts but when I tried to implement it between a module and a script, it fails.
Overview of the my method :
Code inside php module :
<?php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
?>
Code inside php script :
<?php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor'];
?>
Help would be appreciated.