-1
I want to load in the COMBOBOX of the user registration maintenance form the user NAME data coming from MYSQL. I have a method below that does the query in mysql database and returns an array
public function LerDadosUsu(){
try{
$lerusu = "SELECT * FROM usuario ";
$listusu = $this->con->Connect()->prepare($lerusu);
$listusu->execute();
$retDados = $listusu->fetchAll(PDO::FETCH_ASSOC);
return $retDados;
}
catch(PDOException $erro_2){
echo 'erro'.$erro_2->getMessage();
}
}
I have the form below that I want to show this information, but where this the combobox option value does not bring the information that already exists in mysql
<form method="post" name="frm_usuario">
<div class="form-group">
<?php
echo '<label for="filter">Filtrar Usuário</label>
<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span><select class="form-control">
/*crio o objeto para buscar valor*/
$objeto = new Usuario();
$usuario = $objeto->LerDadosUsu();
/*crio um foreach para retornar o campo*/
foreach($usuario as $usuario):
<option value="<?$usuario['.nom_usuario.'];?>"selected>Escolha o usuario</option>
endforeach;
</select>
?>
</div>
</div>
The error that appears in my form when I am running is this below
ERROR: Use of Undefined Constant nom_usuario - assumed 'nom_usuario' in C:.. user.php on line 327
Always add the language tag to the question, this is key to index the question and to make it easy for tag respondents.
– user28595