Hi
Think this question has been answered a 1.000 times before.
But as people do not read The PHP Manual very much, we will tell it again 🙂
PHP Manual in 23 languages !!!!!!
http://docs.php.net/manual/en/
========================================================
A good guess to solve you problem.
Even if I can not be 100% sure it is your case:
On top a page, where you want to use stored $_SESSION
you should make [man]session_start[/man] the first line
like this
<?php
// before anything else. most usually even before: include(this and that)
session_start();
...
...
// later in script get any values
$stored_array_was = $_SESSION['array1'];
// ... and session values are there until script ends
exit();
?>
If we do not start, init, current session, we have not contact with data stored in the session file.
SESSION ... This is a temporary file at the server side,
which is active until visitor closes down his browser.
Then values are lost, and user may have to login again, for a new SESSION.
( 'Remember me', uses not $SESSION to store data.
REMEMBER ME uses $COOKIE files ... [man]set_cookie[/man]
COOKIE files are stored in USER PC, while SESSION files are stored in SERVER PC side.)
User closing Browser will clear CURRENT SESSION values.
Or we can empty any value stored by using script:
<?php
session_start(); // ALWAYS !!!
$_SESSION['array1'] = array(); // make it empty array
$_SESSION['current_username'] = ""; // delete username = logout
$_SESSION['user_data'] = "Brasilian, portugues lang, Mozilla Firefox, screen 768x1024, Visited Pages, today: Buy-Car, Music-Toplist, Bird-watching";
?>
SESSION Variables are a very good thing with PHP.
Makes it easier.
We do not have to write Temporary Files ourselves,
that can remember current online visitors data.
PHP does this for us. If we use $_SESSION variable.
This way data stored in one page, can be used again in other pages.
A bit like using a <form> to post stuff.
But without the need of a Form to be Submitted.
Study all our options in The http://docs.php.net/manual/
Read more about session: [man]session_start[/man] !!!
I wrote a very basic 'mini-tutorial', because we have many guests reading in our forum.
It will not harm, will it?
Notice this: We have silent Guests from all over Our World.
Seeing what we are discussing, but they do not LOGIN or Post anything ----
Many of them comes via http://www.google.com/ searches.
To get get good information and help in PHP matters.
Regards 🙂
halojoy
😃 bet you money,
this topic is found by some Japan, Indian or China person ... GooglinG .. within short