note 29869 added to function.unset
| From: | pvlasenko at hotmail dot com | Date: | Thu, 27 Feb 2003 07:39:22 +0000 |
| Subject: | note 29869 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44594@lists.php.net to get a copy of this message | ||
After struggling for an hour trying to re-assign session values on the same page I have found a
solution. The folowing code is used in a signup form and allows users to move back and forth between
pages modify information and save it to a session.
$user_info = array(
'user' => $user,
'pass' => $passwd1,);
// Get the new session
session_start();
// Destroy session if exsists
unset($_SESSION['user_info']);
// Set session to expire on clients machine
setcookie(session_name(), "", time() - 3600);
// Assign array back to session
$_SESSION['user_info'] = $user_info;
--
http://www.php.net/manual/en/function.unset.php
http://master.php.net/manage/user-notes.php?action=edit+29869
http://master.php.net/manage/user-notes.php?action=delete+29869
http://master.php.net/manage/user-notes.php?action=reject+29869