I do not see the option value menu in PHP

0

my code I already tried it and the error is in this code fragment I use it in XAMP and it loads it correctly but in the hosting it does not my logic is that the local server accepts syntactic errors many times but NOT the hosting but I can not see if there is one.

or if someone has already happened to you?

<div class="form-group">  
    <label class="col-sm-2 control-label">Producto</label>
    <div class="col-sm-5">
      <select class="chosen-select" name="codigo" data-placeholder="-- Seleccionar Producto --" onchange="tampil_obat(this)" autocomplete="off" required>
        <option value=""></option>
        <?php
          $query_obat = mysqli_query($mysqli, "SELECT codigo, nombre FROM estancias ORDER BY nombre ASC")
                                                or die('error '.mysqli_error($mysqli));
          while ($data_obat = mysqli_fetch_assoc($query_obat)) {
            echo"<option value=\"$data_obat[codigo]\"> $data_obat[codigo] | $data_obat[nombre] </option>";
          }
        ?>
      </select>  
    </div>
</div>
    
asked by Michael Angeles 20.07.2018 в 20:41
source

1 answer

0

Try to put the names of the indices in quotes like this:

<div class="form-group">  
            <label class="col-sm-2 control-label">Producto</label>
            <div class="col-sm-5">
              <select class="chosen-select" name="codigo" data-placeholder="-- Seleccionar Producto --" onchange="tampil_obat(this)" autocomplete="off" required>
                <option value=""></option>
                <?php
                  $query_obat = mysqli_query($mysqli, "SELECT codigo, nombre FROM estancias ORDER BY nombre ASC")
                                                        or die('error '.mysqli_error($mysqli));
                  while ($data_obat = mysqli_fetch_assoc($query_obat)) {
                    echo"<option value=\"$data_obat['codigo']\"> $data_obat['codigo'] | $data_obat['nombre'] </option>";
                  }
                ?>
              </select>  
    
answered by 20.07.2018 в 20:46