come dice linoma...leva le parentesi graffe qui e nell' altro ciclo while
echo "<option value=\"{$row['id_ranking']}\" $selected>{$row['danza_ranking']}</option>";
Comunque ho fatto una prova togliendo il comando nella "select" DISTINCT e sembra che riporta l'informazione nella variabile $_POST, ma siccome sono 27993, nella select option mi sembrano tanti, avevo messo DISTINCT proprio per ridurre la casistica!
Eppure mi sembrava fosse più semplice, ma non è cosi!
Come posso risolvere?
Grazie in anticipo!
Non chiedetemi quanti anni ho!!!!
ma fammi capire...levi le graffe e ci metti "|"?
Devo inserire "|"?
Ho riportato sopra quello che ho corretto:
echo "<option value=\"$row['id_ranking']\" $selected>$row['anno_ranking']</option>";
Ho tolto le parentesi graffe! Ho sbagliato? forse ho capito male!
Comunque, e ti chiedo lumi, con la DISTINCT forse c'è qualcosa da aggiungere le option select?
Non chiedetemi quanti anni ho!!!!
me lo posti il codice sorgente di a_rank.php?
Certo ...
Grazie ancora !!!Codice 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" />
<style type="text/css">
input {font-size:8pt;}
</style>
</head>
<body>
<hr></hr>
<table border='1' align="center">
<form action='b_ranking.php' method='post'>
<p align='center'>Inserire il danza e anno per la ranking</p>
<table width="50%" border='1' align="center">
<td align='center'><b>Scegli danza</b></td>
<?php
require('config.php');
// connessione e selezione db
$result = mysql_query("select distinct danza_ranking from ranking order by danza_ranking");
echo "<td align='center'><select name='gara'>";
while ($row = mysql_fetch_array($result))
{
$selected=($danza_ranking== $row['danza_ranking'])?'selected':'';
echo "<option value=\"{$row['id_ranking']}\" $selected>{$row['danza_ranking']}</option>";
// echo "<option value=\"$row['id_ranking']\" $selected>$row['danza_ranking']</option>";
}
echo "</select><tr>";
?>
<td align='center'><b>Scegli Anno</b></td>
<?php
// connessione e selezione db
$result = mysql_query("select distinct anno_ranking from ranking order by anno_ranking");
echo "<td align='center'><select name='anno'>";
while ($row = mysql_fetch_array($result))
{
$selected=($anno_ranking== $row['anno_ranking'])?'selected':'';
echo "<option value=\"{$row['id_ranking']}\" $selected>{$row['anno_ranking']}</option>";
// echo "<option value=\"$row['id_ranking']\" $selected>$row['anno_ranking']</option>";
}
echo "</select><tr>";
?>
</table>
<div align="center">
<hr>
<table width="10%" align='center' border="1" cellpadding="1" cellspacing="0" bgcolor='#ddd000' >
<td align='center'><input type="submit" name="Avanti!" value="Succ. >>>"></td>
</table>
</form>
</div>
</div>
</div>
</table>
</body>
</html>
Non chiedetemi quanti anni ho!!!!
No! Quello sorgente che ti ritorna dal server...l' html interpretato dal browser, ovvero il risultato della tua pagina