PHP会话变量没有注册

I've been searching all day and found several similar issues, but none have resolved my problem. As the title states I'm having trouble with session variables not being "saved" - i.e they work only like local variables. What I'm trying to accomplish:

index page with function "ABC" not running by defualt - link to myscript.php to activate session variable of type boolean - myscript.php checks if session variable is set, if not turns it to true. Otherwise turns it to false: index page should now have function "ABC" activated.

So, here is the funny thing. This worked like a charm earlier today, but after a random refresh, now it don't. Thinking this was a session trouble, I added a session ID but found that the session ID is correct / the same on both the index page and myscript.php.

I've also tried to enable error reporting and found that I'm getting the "Undefined index: showAll in C:\xampp\htdocs\kelvin\ext\set_date.php on line 15". Which is weired, seing as i use the issset function to avoid just that.

myscript.php

<?php
session_start();
echo "Session ID: " . session_id(); //Is the same as on the index page where the script is being called.
---------------
//Sets speed mode on or off (simple or extensive listing).
if(!isset($_SESSION['showAll']))
{    
    $_SESSION['showAll'] == TRUE;
}
 else {
    if($_SESSION['showAll'] == TRUE)
    {
        $_SESSION['showAll'] = FALSE;
    }
    else
    {
        $_SESSION['showAll'] = TRUE;
    }
}
header('location:../index.php');
?>

In advance, thanks for any input :)

Your problem might be here:

if (!isset($_SESSION['showAll'])) {
  $_SESSION['showAll'] == TRUE;
}

The double equal sign (==) checks for equality, but does not set anything.

Try replacing it with the single equal sign (=).


Also, your logic can be condensed considerably:

if (!isset($_SESSION['showAll'])) {    
  $_SESSION['showAll'] = true;
} else {
  $_SESSION['showAll'] = !$_SESSION['showAll'];
}

You are just swapping the value of $_SESSION['showAll'].