Page 1 of 1

Global Variables

Posted: Sun Jan 24, 2010 10:49 pm
by JackD
We have 23 variable values we need passed from one page to another, rather than just string them into a long REST command, write them into a cache file, or write them to a mySQL database.

$_POST gets reset to the values of a form when a button is clicked. $_REQUEST only contains info from the current script.

Is there a SAFE global that can be used to pass values, ie, $_POST['partID'] = '1234', or is there a way to keep $_POST from being reset when a button is clicked. We are trying to stay with PHP and no get into JavaScript.

Re: Global Variables

Posted: Mon Jan 25, 2010 12:18 am
by josh
you want sessions

Re: Global Variables

Posted: Mon Jan 25, 2010 10:42 am
by JackD
I tried using $_SESSION.

Here is what is in detail.php:

$_SESSION['BFL']['mode'] = 'add';
..
..
21 other adds to $_SESSION.

At the end, $_SESSION is set as we would expect it to be. The submit button that is in detail.php invokes cart.php.

However, when in cart.php was invoked, $_SESSION comes in with only the content for httpreferer. Apparently, $_SESSION is getting reset just as is $_POST.