Re: [PHP3] How to use Session Variables?
| From: | (Richard Lynch) | Date: | Wed, 14 Jun 2000 00:16:22 +0000 |
| Subject: | Re: [PHP3] How to use Session Variables? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1782@lists.php.net to get a copy of this message | ||
In article <000f01bfcf49$763db120$cb0ffcc8@coach>, montedonio@terra.com.br
("Leonardo Montedonio") wrote:
> Hey, guys!!!
>
> How do I use session variables???
>
> In ASP... is like :
>
> cod=session("user")
In PHP4, it's like:
<?php
start_session(); //*MUST* come before *ANY* output
session_register('user');
$user = 5;
?>
Then, on following pages, just:
<?php
start_session();
echo $user, "<BR>\n";
?>
Caveat: If your user has cookies turned off, you need a binary compiled
with that --enable-trans-id compilation switch, and have it enabled
php.ini, *OR* you have to tack on <?php echo SID;?> to all your URLs and
FORMs...
See the docs for details on that part.
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)