How to show the selected option of a select with JQuery, in a form at the moment of modifying the data, if the value of the selected object comes from MySql
This is my php code ...
<div class="form-group" id="selectRama">
<label for="rama">Rama</label>
<?php
//Consultar la base de datos
$consultar_mysql_rama = "SELECT * FROM RAMA";
$resultadoRama = mysqli_query($conexion, $consultar_mysql_rama);
?>
<select id="rama" name="rama" class="form-control" required>
<option value="">Seleccione la rama</option>
<?php while ($lista=mysqli_fetch_assoc($resultadoRama)) { ?>
<option value="<?php echo $lista['RAMA_ID']?>"><?php echo $lista=utf8_encode($lista['NOMBRE'])?></option>
<?php } ?>
</select>
</div>
And with JQuery this is what I'm doing ...
$('#rama').html(rama);
But we do not know the value selected in the form when modifying ...