Here is my session array:
Array ( [username] => dog@dog.net [tmpPayment] => Array ( [mID] => 48 [item_1_amt] => 35.00 [description] => Student ) )
I created the ['tmpPayment'] array with the following code:
$tmpPayArr = array();
$tmpPayArr = array('mID'=>$mID,'item_1_amt'=>'35','description'=>'student');
$_SESSION['tmpPayment'] = $tmpPayArr;
I have looked for a simple answer to three questions: (1)how do I add a variable to the [tmpPayment] array (2)how do I change the value of [amount] variable within the [tmpPayment] array (3)how do I remove/delete the [tmpPayment] array altogether. (4)how do I assign the value of ['tmpPayment']['mID'] to a new variable $memberID. For (3) I have unsuccessfully tried:
unset($_SESSION['tmpPayment']);
I think my main problem is not understanding how to REFERENCE the array and its variables properly.
UPDATE: I have successfully added and change my SESSION variable with the following:
$_SESSION['tmpPayment']['item_1_amt'] = $x_amount;
$_SESSION['tmpPayment']['description'] = $x_invoice_num;
Is this best practice? Still need help with (3)...removing the session variable ['tmpPayment'] from the above session array.