html - PHP - link for actual language id -


so i'm building small multilingual (french + english) website , there little bug. remove "english default" language in code, if user picks french on 1 page, page select afterwards in french , not "back" english. same if user picks english in first place. since there more french users, default language on home page.

the content in folder prefixes: fr_language.php , en_language.php

the lang.php file here

links fr or en

    <a href="?lang=fr">français</a>     <a href="?lang=en">english</a> 

and navigation

<ul>     <li><a href="index.php"><?php echo $lang['home']; ?></a></li>     <li><a href="services.php"><?php echo $lang['services']; ?></a></li>     <li><a href="about.php"><?php echo $lang['aboutus']; ?></a></li>     <li><a href="contact.php"><?php echo $lang['contact']; ?></a></li> </ul> 

thanks help!

edit:

ok great, it's working! in "nav.php" include, i wrote this. perhaps it's possible cleaner version, haha! ideas? again!

consider using following approach/method:

if(isset($_get['lang']) && $_get['lang'] == "fr"){      //   } else {     // else  } 

you should made aware of (xss) cross-site scripting.

here few links read on:

you can further research using "xss injection php" keywords in favorite search engine.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -