SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 to 3 languages

    hello everyone,

    I'm new to php, just learning and I've got a 2 language site and have to make it in 3. It uses a session variable so if the user clicks a flag he's or she's choice is sent to session, that part I got it but how do I make the page submit 3 different values to $lang in here:

    <form action="index.php" method="post" name="change_lang">
    <input type="hidden" name="lang" value="<?= ($lang == "en") ? ("fr") : ("en")?>">
    </form>

    ?

    so I need like 3 hidden fields, each for <?= ($lang == "en") ? ("fr") : ("en")?>
    <?= ($lang == "en") ? ("ru") : ("en")?>
    <?= ($lang == "en") ? ("en") : ("en")?>

    but I've already tryed that and it doesn't work. Any ideas? Thanks for your time

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this
    PHP Code:
    <form action="index.php" method="post" name="change_lang">
    <input type="hidden" name="lang" value="<?= ($lang != 'en' && $lang != 'fr') ? 'ru' :(($lang =='en')?'fr':'en')?>">
    </form>
    i din't test it, just writing right of the head. hopefully this will work.
    ---------------------------
    Errors = Improved Programming.
    My Site

  3. #3
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you! It worked great, except that every flag I click has the same effect: it changes between the 3 languages. I suppose it's because I only have one hidden field?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •