I'm wanting to add a new index to the $_SESSION['fsb']['order'] array, and based on the action selected by the user in the form, it does that just fine in the case of "$stuff['formButtons']['addABag']", however, even though the new index is added successfully to the session array, the line highlighted in red under the "default" case, STILL executes wiping out the new index that I just created. I know this, because I printed out the array before the "break" on the proper case, and after the close of the switch. Before the break, the array was properly populated; after the close of the switch, the new index that I had just seen, was gone, and the $_SESSION['fsb']['order'] was empty.
Then, I commented out the red line in the default case and the session was properly populated outside of the switch. One other interesting thing, the line, "$bagNum = 1;" is not executed, even though the line above it is.
Can anyone see why this statement would be executed, or if I have something in my code that is causing this that I am overlooking?
Code:switch($action) { case $stuff['formButtons']['oops']: header('Location:'.$stuff['page']['stepTwo']); exit; break; case $stuff['formButtons']['lastBag']: case $stuff['formButtons']['changes']: addBagToSession($_POST, $bagNum); header('Location:'.$stuff['page']['stepTwo']); exit; break; case $stuff['formButtons']['addABag']: if(substr($_SERVER['HTTP_REFERER'], strlen($stuff['page']['stepOne'])*-1) == substr($thisPage, strlen($stuff['page']['stepOne'])*-1)) // This is so we don't wipe out the bag when adding from the review screen { $_SESSION['fsb']['order'][$bagNum] = addBagToSession($_POST); $bagNum++; } $_SESSION['fsb']['bagNum'] = $bagNum; break; case $stuff['formButtons']['edit']: $bagNum = $_POST['bagNum']; break; case $stuff['formButtons']['remove']: removeFromOrder($_POST['bagNum']); header('Location:'.$stuff['page']['stepTwo']); exit; break; default: $_SESSION['fsb']['order'] = array(); $bagNum = 1; break; }








Bookmarks