Replacement for "$_SESSION"?

Hello everyone, I need help with what to do with my page since SESSION won’t work for me. The reason that I can’t use sessions is because register_globals is set to “off” on the server and I am not allowed to change that.

I need to collect data input by the user on Page-1, then I need to be able to retrieve that data on Page-2. The data consists of over thirty variables so I really do not want to store the info the URL; I also do not want to use cookies to avoid problems if the user has cookies disabled.

Can someone please direct me to what I should use instead of “$_SESSION”?

Code example is as follows:


<?php session_start(); ?>

HTML Stuff

BODY Stuff

// Get values from user inputs in the form and store them in SESSION variables

$_SESSION[‘Taxes’] = ($_POST[‘element_5_1’]+0);
$_SESSION[‘Loan1’] = ($_POST[‘element_8_1’]+0);
$_SESSION[‘Loan2’] = ($_POST[‘element_9_1’]+0);

// Retrieve the SESSION variables and store them in new variables for calculation

$Taxes = ($_SESSION[‘Taxes’]+0);
$Loan1 = ($_SESSION[‘Loan1’]+0);
$Loan2 = ($_SESSION[‘Loan2’]+0);

Thank you!

The register_globals actually does not affect on $_SESSION variable. In your code you’re missing session_start() function call in the Page-2. You need to have this line on each page where you want session variables to be available.

Sponsor our Newsletter | Privacy Policy | Terms of Service