Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
How to display the selected values correctly in bootstrap dropdown function?

I am using bootstrap to create select multiple function. Now my problem is I want to follow my selected value to show in the select multiple function, but it cannot work. Below is my problem coding:

<select id="jabatan_edit" name="jabatan_edit" title="Jabatan" class="form-control">
    <?php
    $sql_jabatan = 'SELECT * FROM jabatan where is_active=?';
    
    $types[] = 'i';
    $values[] = 1;
            $row_jabatan = base_mysqli_select($sql_connection, $sql_jabatan, $types, $values);
            foreach ($row_jabatan as $val_jabatan) {
                $jabatan = "1,3";
                $check_jabatan = $val_jabatan['id'];
                $jabatan_value = explode(',',$jabatan);
                    if (in_array($check_jabatan, $jabatan_value ))
                      {
                      $selected_jabatan = 'selected="true"';
                      }
                    else
                      {
                      $selected_jabatan = 'selected="false"';
                      }
                 echo '<option value="' . $val_jabatan['id'] . '" ' . $selected_jabatan . '>' . $val_jabatan['kod_jabatan'] . '</option>';
            }
            
    unset($types);
    unset($values);
    ?>
</select>

This is my javascript function:

$('#jabatan_edit').multiselect({
        nonSelectedText: 'Pilih ahli-ahli',
        enableFiltering: true,
        enableCaseInsensitiveFiltering: true,
        buttonWidth:'100%'
        });

My output is shown me like below the picture, the result just can show $jabatan value = 3:

a1

May I know how to display the selected values correctly? For example I want the actual result like below can show $jabatan value = 1,3:

o1

Hope someone can guide me on how to solve this problem. Thanks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda