Hi.
I have a session variable stored within a cookie, and I want this to change when pressing a hyperlink.
i.e. I have this variable
This is set initially if it hasn't been set before using an if statement:
I want to set this variable to something else using a hyperlink; like a language bar:
The problem is that the code enclosed in the php tags is invoked wether i press the link or not. It just runs. How do I restrict it to run only when pressing the link?
Thanks in advance.
I have a session variable stored within a cookie, and I want this to change when pressing a hyperlink.
i.e. I have this variable
Code:
$_SESSION['language'] = 'en_US';
Code:
if (! isset($_SESSION['language']))
{
$_SESSION['language'] = 'en_US';
}
Code:
<a href="<?php $_SESSION['language'] = 'nb_NO'; ?>">Bokmål</a> | <a href="<?php $_SESSION['language'] = 'nn_NO'; ?>">Nynorsk</a>
Thanks in advance.
Comment