Language Kit - Language Select Dropdown Issue

Hey there,

sorry i am new with php.
i used the kirby language kit.
everything works fine. no i want to display the language selection in dropdown.
i tried this. it shows the dropdown, but the navigation between the sites don´t work.

    <nav class="navigation  menu column" role="navigation">
      <ul class="site-nav">
        <?php foreach($pages->visible() as $item): ?>
        <li class="menu-item<?= r($item->isOpen(), ' is-active') ?>">
          <a href="<?= $item->url() ?>"><?= $item->title()->html() ?></a>
        </li>
        <?php endforeach ?>
        &nbsp;|&nbsp;
    <select>    
    <?php foreach($site->languages() as $language): ?>
    <option>    
    <li class="languages-item<?php e($site->language() == $language, ' is-active') ?>">
          <a href="<?= $page->url($language->code()) ?>"><?= str::upper($language->code()) ?></a>
        </li>
    </option>
        <?php endforeach ?>
</select>
  </ul>
</nav>

thank you very much for tipps and helping
cheers

Are you on Kirby 2 or 3?

K2: https://k2.getkirby.com/docs/languages/switching-languages

K3: https://getkirby.com/docs/guide/languages/switching-languages

i used this:

There are several problem with your HTML markup that are not at all related to PHP or Kirby.

  1. You can’t have a select element as direct child of an ul element
  2. You can use anker links or li elements inside an option tag, you would need JavaScript to redirect to another page when the user selects something.

The first link I posted above has an example how to set up a language switch. Why don’t you work with a standard link list instead of a select field?