Hi. As part of my effort to learn PHP, and (eventually) build a fully interactive website, I've recently been looking into PHP sessions.
I've read Webmonkey's article and I think I've got a pretty good understanding of how sessions work. However, when I try to run this basic script, it doesn't work properly. It's a simple count script that tells the user how many times they've visited the page during the session. Every time I visit the page, however, it always echoes '1'.
Here's the code:
<?php
session_start();
if(!$PHPSESSID)
{
session_register('count');
}
elseif(!$count)
{
session_register('count');
}
$count++;
echo $count;
?>
I just can't see why it doesn't work. Please, tell me what I'm doing wrong.