1
I have a id
table, example:
user with id = 1
, how can I get this user’s name using the id
of it and show in a input
?
I did so:
while ($dados = mysql_fetch_array ($sql)) {?>
<option value="<?php echo $dados["id"] ?>" ><?php echo $dados["nome"]; ?></option>
When it selects the show option in a input
the description of what would be, for example:
id = 1
: banana (show banana in input)id = 2
: meat (show meat in input)
I know it’s a weird example why I don’t know how to explain
To display data, you can use the following form:
while($dados = mysql_fetch_array($sql)){
 echo "<input type='text' value='" . $dados['id']. " - ". $dados['nome'] + "' />";
}– Elexsandro Rangel dos Santos
Sorry I forgot a detail the input I want to pull the name is out of the while
– Vagner
You can create a variable outside the loop and set its value for display. Ex: `$value = '; while(.....) { $value = $data['name']; ... } echo $value;
– Elexsandro Rangel dos Santos