How can I read the data of a db sql in an input text html5?

0

Here I have the code that works with the select ... but I can not get it to the input text.

 <div class="form-group">
   <input type="text" value="" name="nombrecliente" id="nombrecliente" 
      class="form-control input-lg" autocomplete="off" placeholder="Nombre Cliente"/>
      <?php //*--conexion*//
       $mysqli = new mysqli('localhost', '*********', '*****', '********');
       mysqli_set_charset($mysqli, "utf8"); //*--conexion*//                    
       $query = $mysqli->query("SELECT * FROM clientesguaca"); //*--variable 
       llamadatos*//
       while ($valores = mysqli_fetch_array($query)) {
      echo '<input value="' . $valores[nombrecliente] . '">' . 
      $valores[nombrecliente] . '</>';
      }
      ?>
   </div>
    
asked by Stefano Fotograficoweb 01.11.2018 в 12:57
source

1 answer

0

Try this way:

<?php 
    $mysqli = new mysqli('localhost', '*********', '*****', '********');
    mysqli_set_charset($mysqli, "utf8");
    $query = $mysqli->query("SELECT * FROM clientesguaca");

?>
  <div class="form-group">
    <?php 
        while ($valores = mysqli_fetch_array($query)):?>
            <input type="text" value="<?php echo $valores['nombrecliente']; ?>" class="form-control input-lg" autocomplete="off" placeholder="Nombre Cliente">
        <?php endwhile; ?>
    ?>        
   </div>
    
answered by 01.11.2018 в 13:17