Ver Mensaje Individual
  #20 (permalink)  
Antiguo 22/04/2009, 08:58
Adell
 
Fecha de Ingreso: abril-2008
Mensajes: 435
Antigüedad: 16 años
Puntos: 10
Respuesta: Select dinamico

El option tiene que estar dentro del while para que genere un option del select en cada iteracion del bucle

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form>
<select name="nombre">
<?php


$sql 
"SELECT nombre FROM id_usuarios";
$consulta_numero1 mysql_query($sql,$conexion);

while(list(
$nombre) = mysql_fetch_row($consulta_numero1)) {
?>

<option value="<?php echo $nombre;?>"><?php echo $nombre;?></option>
<?php ?>
</select>
</form>
</body>
</html>