Values of a Select with php

0

How do I return the values in a select with a foreach?

I have two values in my Events table in the event_estate column which are Started and Completed , how do I get the two of them since this way only It gives me only one value and not the other.

Thank you in advance.

This is my code:

<div class="form-group">
    <label for="estado_evento">Estado del Evento:</label>
    <select name="estado_evento" id="estado_evento" class="form-control">
        <option>
            <?php echo $eventos->estado_evento?>
        </option>
      </select>
</div>
    
asked by WilsonicX 22.05.2018 в 20:14
source

1 answer

0

Regarding your doubt, how to iterate the content of the $ events object to get the N values of the event_event attribute, you could help with this block.

<?php
foreach ($eventos->estado_evento as $valor) {
        echo "Estado evento: $valor<br />\n";
} ?>

The official PHP documentation

is also very useful.     
answered by 22.05.2018 в 20:33