Forum Moderators: open
I've got a scenario where I would like to alter a PHP $_SESSION array via Javascript. It's like this:
1. PHP page is displayed containing a number of form elements for a person's name, position, hair color, etc.
2. During page display, a PHP $_SESSION array is set: $_SESSION['TSets'] = array('RegInfo');
One of the form elements on this page is a checkbox. When the checkbox is clicked a fieldset is shown via Javascript.
Now IF this checkbox is clicked, I need to alter the $_SESSION array shown above from $_SESSION['TSets'] = array('RegInfo'); to $_SESSION['TSets'] = array('RegInfo','CreditCard');
Conversely, if someone has already clicked the check box, then changes their mind and un-clicks it, I need to once again alter the session from $_SESSION['TSets'] = array('RegInfo','CreditCard'); back to simply $_SESSION['TSets'] = array('RegInfo');
Now I know that PHP is server-side and Javascript is client-side, but since PHP sessions are persistant, I don't see why (theoretically) Javascript couldn't alter a PHP Session VAR or a session Array.
So, since I don't know how to code in Javascript my question is: A) can this be done, and B) if it can, would someone show me a little code snippet on how this can be accomplished?
Thanks to all in advance,
Neophyte
HTH