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.
Global Variables
Moderator: General Moderators
Re: Global Variables
you want sessions
Re: Global Variables
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.
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.