Bootstrap Validator does not validate select with php data

Asked

Viewed 117 times

0

Good I have in my form field select which is populated with data coming from the database, but with the use of Bootstrap Validator, it does not validate correctly, now if I take the code PHP it validates correctly. What can it be.

Below this is my select field:

 <div class="form-group">
    <label for="AgentePG" class=" control-label">PG</label>
    <select class="form-control" id="AgentePG" name="pg" data-bv-notempty data-bv-notempty-message="The country is required">
    <option value="">Selecione...</option>
    <?php
      $sql = DB::getInstance();
      $sql = "SELECT * FROM pg";
      $stmt = DB::prepare($sql);
      $stmt->execute();
      $busca = $stmt->fetchAll();
          foreach ($busca as $linha) {
             echo '<option value=' . $linha->id . '>' . $linha->pg . </option>';
          }
      ?>
   </select>
 </div>

1 answer

1

Maybe it’s a syntax error in those quotes. Copy that line and replace it.

echo '<option value="' . $linha->id . '">' . $linha->pg . '</option>';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.