Here is another way:
$SRT = $_GET['sort'];
echo $_SESSION['DOSORTINGBY'].' ';
if($SRT!=''){
if($_SESSION['DOSORTINGBY']==$SRT){
$sql.=" $SRT ASC";
$SRT="none";
} else {
$sql.=" $SRT DESC";
}
} else {
$sql.= " id ASC";
}
$_SESSION['DOSORTINGBY']=$SRT;
echo $_SESSION['DOSORTINGBY'];
In this example, the output is ALWAYS:
none lname
none email
etc
So its like it just does not care that I did $_SESSION['DOSORTINGBY']=$SRT;
The session does not actually save it.