while($row = mysql_fetch_array($listanombre)){ $nomlista = $row["CODIGO"]; print "<option value=\"$nomlista\">" . $row["NOMBRE"] . "</option>"; }