Forum Moderators: coopster
if ($test == 1){
unset($_SESSION['OUT']);
}
as you can see i do unset the variable after prinitng
the $_SESSION['OUT'] variable is set in another file, that file is activated from the 1st.php file via a form submit where the file 2nd.php initializes the OUT variable and then comes back to 1st.php .
This all thing works fine but for some reason when i close the popup and reopen "that is the 1st.php" I get the $temp which should not appear cause the _SESSION['OUT'] has been unset, tried unsetting the whole session still the same thing happens
Any ideas guys , thank you in advance
Take a look at Session handling functions [php.net].
There are better functions for testing/unsetting session vars like
session_is_registered [php.net]
session_unregister [php.net]
You also need to use session_start [php.net] at the top of every page before any output is sent to the browser.
You could use a named session and then use those functions or you could try testing for a specific value in the session var. It is a little strange. have you messed with different functions to kill the session? ie (session_unset and session_destroy)
An associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.
hm, it should work as long as the session is set as a cookie but it will not be a reliable way to check. If someone has cookies blocked it may end up appended to the url instead.
I changed my session_name in the whole website so now it has a name , hoping to see if the name would be different if a session doesn't exist
So
session_name("k");
session_start();
these should be in the pages that session start
so now the page where i want to check if the session has been started or not
session_name();
this doesn't work cause as the documentation says
The session name is reset to the default value stored in session.name at request startup time. Thus, you need to call session_name() for every request.
So it's a new request and it will return the default whether a session does exist or not .
Same thing regarding session_id();
So running out of options anyways i'll see what will happen next , by the way thanks jatar_k for the followups