The SID isn't doing anything because you're not actually creating a LINK with it -- you're just echoing it to the user.
That said, when you refresh the page, PHP still doesn't have a session ID, so it creates a new session every time.
If you configure PHP to use cookies to store the session ID, and to enable the transparent session ID feature, then your code will work when you refresh the page. That's because the SID is stored in a cookie on the user's machine, so their browser sends it to PHP via HTTP headers, instead of attaching it to all links and via hidden input fields in all forms...
make sense?
Take care,
Nik
http://www.bigaction.org/