How can I load a selected of an option through the php code? since I need to edit several data from a table, but I need to load the data of the record, but in the filters I need to appear by default the value of the result of the query, but I also appear all of the list of the combo.
I show my code.
$query2="select id_categoria, descripcion from categoria;";
$result2=$con->query($query2);
while ($reg2=$result2->fetch())
{
echo '<option value='.$reg2['id_categoria'].' selected="'.$reg['id_categoria'].'">'.$reg2['descripcion'].'</option>';
//echo '<option value='.$reg2['id_categoria'].' selected="'.$reg['id_categoria'].'">'.$reg2['descripcion'].'</option>';
}?>