I'm new to Drupal and need insigh on the workings of it's session management, my goal is to send variables over different pages.
This first piece of code gets a value from the frontpage then redirects to the next page.
<?php
session_start();
$_SESSION['beer'] = $_GET['g'];
header("Location: http://127.0.0.1/drupal/Page2.php");
exit();
?>
Next page is this
<?php
session_start();
echo $_SESSION['beer'];
?>
Page2.php echos the value of $_SESSION['beer'] as it should.
Now when i copy this same code as a page inside Drupal 7 content modules.
Change header location in php file
<?php
session_start();
$_SESSION['beer'] = $_GET['g'];
header("Location: http://127.0.0.1/drupal/node/1");
exit();
?>
Add code to Drupal page
<?php
/*session_start();*/ / Already initialised in drupal
echo $_SESSION['beer'];
?>
But the results of $_SESSION['beer'] comes back undifined.
Notice: Undefined index: beer in eval()
Why?