At 12:46 04.12.2002, Anders Thoresson spoke out and said:
--------------------[snip]--------------------
><?php echo $_COOKIE["PHPSESSID"]?>
><BR>
><BR>
>Hello visitor, you have seen this page <?php echo $count; ?> times.<p>
>
>To continue, <A HREF="visasida.php?<?php echo SID?>">click here</A>
>
>  The session id isn't attached to the link in the end of the script, and 
>therefore $count always is '1', even after I click the link.
>
>  But the $_COOKIE["PHPSESSID"] does contain a value.
--------------------[snip]-------------------- 

Your system date is way off (Dec 4th instead of Dec 16th), so I may be late
in noticing your post...

The SID constant is only set if necessary, which means if you don't (or
can't) use a session cookie.

If your server is setup to use session cookies, and the client browser
returns it, SID will be empty. In this situation even the trans_sid
mechanism would change nothing in HTML output.

Anyway your problem is most certainly not tied to that, as the session
should perfectly being set up using the session cookie. You're using
session_register in version 4.2.2, where globals are not registered by
default (check the register_global setting in php.ini). You should use the
session array ($_SESSION['count']) to handle session persistent data:

    html_begin ($title, $header); 
    if (!array_key_exists('count', $_SESSION)) { 
       $_SESSION['count'] = 1;
    } 
    else { 
       $_SESSION['count']++; 
    }

end then

    <?php echo $_COOKIE["PHPSESSID"]?> 
    <BR> 
    <BR> 
    Hello visitor, you have seen this page <?php echo $_SESSION['count'];
?> times.<p>
    To continue, <A HREF="visasida.php">click here</A>



-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
    ^ http://www.vogelsinger.at/



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

Reply via email to