Entry
Why are session variables being replaced instead of appended?
Jan 21st, 2008 16:49
Tim Stumbaugh, Kevin Jackson,
Background:
I've written a Session Class (PHP5) that handles my sessions for me. In
the class, I'm implementing "session_set_save_handler" to store the
session data in a MySQL database.
To test the class, I created a test page where the form is
self_referring (i.e., the action is $_SERVER['PHP_SELF']), and the form
requests a variable name and value from the user. When the user submits
the form, what is supposed to happen is the new variable name and value
get added to the session. Someone should theoretically be able to set
in front of the broser and add name/value pairs all day. That's what is
SUPPOSED to happen...
What actually happens is that the new name/value pair OVERWRITES the
previous pair instead of appending it.
WHY???
--------------------
From what I understand about sessions, this is correct behavior. Even if
you use php's built-in session handler, variables still get overwritten.
Try using a unique name.