Save a incoming url parameter as a session variable

Post date: 2020-06-29 09:44:16
Views: 124

I want a user to be able to filter out questions written in a specific language, and do it using an url-parameter when entering the site. 

I am in qa-base.php accessing the url-parameter, but I can't seem to keep the variable value when I switch to some of the other pages. Trying with using session variable, but cant get it to work. 

    $thelang=qa_get('thelang'); // get from URL parameter if possible

    if(isset($thelang)){

        $_SESSION'thelang'] = $thelang;

        echo "<br>Got GET Parameter!<br>";        

    } else { // get from SESSION variable

        $thelang = $_SESSION'thelang']; // this part doesn't seem to work.

    }

Thanks for any help! Maybe there is better ways to save the variable between pages.

Please click Here to read the full story.
 
Other Top and Latest Questions:
Ripley: VI - Some Heavy Instrument
Morgan Stanley tops expectations on wealth management, trading and investment banking results
Israel's war Cabinet is locked between restraint and revenge
Help me assess the morals of applying for a C-Suite role
New Baby, Good Neighbors
Meaningful birthday gift for 10yo (first of series) ?
Answered: [New theme] - POLARIS
Potential Trump trial jurors dismissed because of bias against former president
Why a $100,000 income no longer buys the American Dream in most places
Biden administration releases draft text of student loan forgiveness plan. Here's what borrowers need to know