How to submit via the form in PHP, the selected option of an HTML5 select / option?

1

ThefunctionObtem_Todas_Metareturnsthequeryofthedatabase,ImaketheassociationgettheidthatIneedandsendbytheform,butthevalueIselectedisnotsentcorrectlybecauseitsendsthelastonevalueandsometimesthefirstoftheoptionlist.

<selectname="opcaometa">
    <?php 
    $dados = Obtem_Todas_Meta();                  
    while ($resultado = mysqli_fetch_array($dados)){    ?>      
        <option  value="3"><?php echo $resultado['id_met']."-".$resultado['titulo_met']; ?>
        </option>
    <?php }?>
</select>
    
asked by anonymous 26.06.2017 / 15:13

1 answer

0

You can not pass the value field blank or with a fixed value, you have to pass the information you want on the other page (id or name):

Example:

<option value="'.$resultado['id_met'].'">'.$resultado['id_met']."-".$resultado['titulo_met'];.'</option
    
26.06.2017 / 16:28