Record in the corded session of a Link and destroy another session to do site translation

insert the description of the image here

How Can I make that by clicking on a flag it records in a session the data referring to your language

  • Brazil = = > saves the string " br "
  • United States = = > saves the string " usa "

And clicking on one destroy the other

Estou indo por esse principio mais não sei se é o correto
lng = $_REQUEST['lng'];
$_SESSION['lng'] = $lng; 


<a href="<?echo $nome_do_arquivo?>?lng=br"><img src="img/br.jpg" width="28" 
height="16" alt="Image" data-retina="true"/></a>

<a href="<?echo $nome_do_arquivo?>?lng=usa"><img src="img/lang_en.png" 
width="28" height="16" alt="Image" data-retina="true"/></a>

<a href="<?echo $nome_do_arquivo?>?lng=fran"><img src="img/lang_fr.png"  
width="28" height="16" alt="Image" data-retina="true"/></a>

<a href="<?echo $nome_do_arquivo?>?lng=spain"><img src="img/lang_es.png" 
width="28" height="16" alt="Image" data-retina="true"/></a>
Author: Fabio Henrique, 2017-10-05

1 answers

This can be done with a request POST or GET (POST it becomes more pleasant for the customer) simple. After receiving the request, just save the user's SESSION or even the DB (if the user is logged in). I will not demonstrate the code as it is a fairly simple thing and you should be able to do the implementation.

 0
Author: FFY00, 2017-10-05 22:43:39