Hello.

I have installed XAMPP (light) on my windows xp pc - But there is something wrong with my SESSIONS. If I declare a session it does not work across pages:

page1:
if (!isset($SESSION)) {
session_start();
}
$
SESSION["sestest"] = "hello";
echo $_SESSION["sestest"];

page2:
if (!isset($SESSION)) {
session_start();
}
echo $
SESSION["sestest"];

page1 says hello, but nothing at page2. Please help.

Best regards.
Asbjørn Morell.

    It works for me but you don't need the conditional. Replace:

    if (!isset($_SESSION)) {
    session_start();
    }

    with

    session_start();

    If you are worried that a session might already be running use the following instead:

    session_id() or session_start();

      bang! That did the trick 🙂 It is strange because it worked with:

      (!isset($_SESSION)) {
      session_start();
      }

      on my dedicated linux server :/

      Best regards.
      Asbjørn Morell.

        Write a Reply...