Re: how to unregister session stored as multidimensional array?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 05, 2005 at 02:45:43PM -0600, afan@xxxxxxxx wrote:
> Is this possible at all:
> I have stored info from form in session:
> $_SESSION['client']['name'] = 'Name'
> $_SESSION['client']['address'] = 'Address'
> $_SESSION['client']['city'] = 'City'
> $_SESSION['client']['state'] = 'State'
> $_SESSION['client']['zip'] = 'Zip
> 
> Now, I want to unregister all $_SESSION['client'] info EXCEPT 
> $_SESSION['client']['name'].

All you need to do is redifine what the $_SESSION['client'] array's
definition is:

  $_SESSION['client'] = array('name' => $_SESSION['client']['name']);


> 
> With
> session_unregister('client');

Don't mix session_*register() functions with the use of $_SESSION.
Those functions are only there for old scripts to work, see
http://php.net/session_unregister (the second Caution)

To register a session var:

  $_SESSION['client'] = $client;

To unregister a session var:

  unset($_SESSION['client']);

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux