Adding values to an existing Session array |
[eluser]BrandonDurham[/eluser]
I am creating a session array called "entry_data" and filling it with a few values, like this: Code: $entry_data = array( How do I go about later adding more values to the $entry_data session array without overwriting the data that's already there? Thanks!
[eluser]mironcho[/eluser]
I don't know if there is better way, but you can retrieve 'entry_data' array from session, alter it, and store it again in session (with the same name).
[eluser]Pygon[/eluser]
Brandon: Hey there. Array() is typically used to create a new array. Thereafter, you can use: $entry_data['newkey'] = "newdata"; This will add new data without removing the rest of your data. If you would like to add data to the end of the array, without having a specific key, you can use: $entry_data[] = "newdata"; I would highly suggest reading: http://www.w3schools.com/php/php_arrays.asp
|
Welcome Guest, Not a member yet? Register Sign In |