2
You can use the foreach, in your case I understood that you would be showing the value in your correct input?
The structure of the foreach is
foreach($array as $linha){
}
It will perform an iteration (just like the structure for), for each row 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"], the foreach would run 3 times, and in each iteration the value currently being accessed would be used by the variable after the "as" in the case of the example above the variable $line.
In case your code would look something like this:
foreach($array as $valor){
<input type="text" class="form-control" name="lanches" id="lanches" value=" <?php echo $valor; ?>" >
}
The code will not work. html is loose in the middle of php. One option is to put in a
echo
or close php (?>
) before html and reopen after– edson alves