How to give parameter lang to another url

时间:2017-06-09 12:37:43

标签: javascript php html gettext

I use GetText library to have a multilingual website. It works great on my first page with this url http://localhost:8080/index.php?lang=en_US

But inside my page, I have link to another page. I'd like to keep lang=en_US to send to the second page to have this dynamically according to the selected language:

<a href="contact.php?lang=en_US">text here</a>

I don't know how to do it, if I have to create the url with appending string by getting parameter the first time and concatenate it? or session ?

1 个答案:

答案 0 :(得分:0)

One solution would be to change your links to something like this:

<a href="contact.php?lang=<?=$_GET['lang']?>">text here</a>