Ver Mensaje Individual
  #12 (permalink)  
Antiguo 28/10/2008, 14:43
Avatar de gokufast
gokufast
 
Fecha de Ingreso: abril-2007
Mensajes: 540
Antigüedad: 17 años, 10 meses
Puntos: 3
Respuesta: Mostrar campo de select "selected" de una consulta con php y mysql

Gracias, me sirvio para iluminarme.

aca pongo como lo hize.

Código PHP:
$result_2 mysql_query("SELECT sexo FROM abm WHERE id=$_GET[id]"$link); 
    
$checked '';
    while (
$row_2=mysql_fetch_array($result_2))
    {
        if (
$row_2["sexo"]=="mas")
        {
        
$checked 'checked';
        echo 
"<td><input name='sexo' type='radio' value='mas' ".$checked.">Masculino";
        echo 
"<input name='sexo' type='radio' value='fem'>Femenino</td>";
        }
        if (
$row_2["sexo"]=="fem")
        {
        
$checked 'checked';
        echo 
"<td><input name='sexo' type='radio' value='mas'>Masculino";
        echo 
"<input name='sexo' type='radio' value='fem' ".$checked.">Femenino</td>";
        }
    }