----- Original Message ----- From: "Tomás Herink" > Hi leds! > > I am trying to use sessions for the first time. Logging in and starting > session is not a problem, but when I click an URL to some other page, > session_id() variable is empty. How to keep the session active within all of > my pages?
Hi Tomás, You need to have session_start(); in every page that you want to keep the session alive. <?php session_start(); No html, blank lines or white space before the <?php opening tag. session_start(); doesn't have to be the first line, but it's usually best. You must not have any html output before it! <?php if ($x == 'y') $a = 3; session_start(); Will work just fine, but there would be no reason to do this :-) Put session_start(); first. <?php echo "Hello"; session_start(); Won't work as there's html output! Regards, Bob E.