Re: sessions and php
| From: | Justin French | Date: | Fri, 19 Sep 2003 04:48:13 +0000 |
| Subject: | Re: sessions and php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163097@lists.php.net to get a copy of this message | ||
Assuming PHP >= 4.1
page1.php
<?
// continue or create a session
session_start();
// set some session vars
$_SESSION['color'] = 'red';
$_SESSION['name'] = 'Justin';
?>
page2.php
<?
// continue or create a session
session_start();
// echo some session vars
echo "Hello {$_SESSION['name']}, your favourite color is {$_SESSION['color']}";
// clear some session vars
unset($_SESSION['name']);
// modify some session vars
$_SESSION['color'] = 'blue';
?>
Similar tests can all be found on http://au.php.net/session
Justin
On Friday, September 19, 2003, at 12:22 PM, Patrik Fomin wrote:
Hi, can anyone help my list the ways to create/view a session, i need to find out if my host supports any of em (kinda strange host), eg: page1.php start_session["test"] register_session["test2"] etc page2.php retrive session 1, 2 etc and display their contents regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- [This E-mail scanned for viruses]