How can I enter the data of a query from a database in mysql in a jump menu?

0
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
    <select id="nom" name="nom">
    <option value="1"> .$row['nombre']. </option>
    </select>
}

asked by Alejandro Esquivel 05.03.2018 в 02:52
source

1 answer

2

Be sure to place the code next time, it's easier.

I do not accept the impression of the select because the instructions

<select name="nom" id="nom">
    <option value="1">.$row['nombre'].</option>
</select>

they are not php language, you must put everything on text in the following way

echo '<select id="nom" name="nom">';
while($row = $result->fetch_assoc()) {
    echo "<option value=\"1\">{$row['nombre']}</option>";
}
echo '</select>';
    
answered by 05.03.2018 / 03:04
source