<input type="text" class="form-control" name="lanches" id="lanches" value="<?php echo $resultado['lanches']; ?>" >
I have this input above where it receives this array that is inside the database
How do I ...
You can use the foreach , in your case I understood that it would be showing the value in your correct input?
The foreach structure is
foreach($array as $linha){
}
It will perform an iteration (just like the for structure), for each line of your Array, and in each iteration you will perform the manipulation with the $ line variable.
For example, if you had this array: $ array = ["pos1", "pos2", "pos3"], foreach would run 3 times, and at each iteration the value being accessed would be used by the variable after the "as" in the example above the variable $ line.
In case of your code it would look something like this:
foreach($array as $valor){
<input type="text" class="form-control" name="lanches" id="lanches" value=" <?php echo $valor; ?>" >
}
You can use a foreach. It would look something like this:
foreach($resultado['lanche'] as $id){
echo "<input type='text' class='form-control' name='lanches[$id]' id='lanches_$id' value='$id'>";
}
Good night, use the foreach. documentation: link