Ciao a tutti vi spiego subito il problema...devo creare una pagina web fatta in questo modo:

Cognome: --menù a tendina--
Periodo: da --textbox-- a --textbox--
submit

Ovviamente poi questa farà un'interrogazione al database e mi fornirà una tabella come risultato.
Ma il problema è un altro: come faccio a creare questo menù a tendina in cui i valori di scelta possibili sono quelli presenti in un database?

Io ho provato così, ma non so se è un errore o se sono io che non so usare easyphp per testare...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>
<head>
<title>Progetto</title>
</head>
<body>
<h4> Ricerca accessi ai laboratori </h4>
<form method="get" action="test.php">
<table>
<tr> <td> Cognome: </td>
<td>
<select name = "selectcognome">
<?php
if(!mysql_connect("localhost","username","password "))
die('Impossibile creare una connessione' . mysql_error());
if(!mysql_select_db("progetto"))
die('Impossibile accedere al database' . mysql_error());
$cognomi="SELECT DISTINCT Cognome FROM Studenti WHERE Matricola IN (SELECT DISTINCT Matricola FROM Accessi)";
$result=mysql_query($cognomi);
if(!$result)
die('Errore nella query' . mysql_error());
while($row=mysql_fetch_assoc($result)) {
echo "<option value=\"$row[Cognome]\">$row[Cognome]</option>";
}
?>
</select>
</td>
</tr>

<tr>
<td> Periodo: </td>
<td> da </td>
<td> <input type="text" size="10" maxlength="10" name="periodo1"> </td>
<td> a </td>
<td> <input type="text" size="10" maxlength="10" name="periodo2"> </td>
</tr>
</table>


<input type="submit" value="Cerca">
</body>
</html>


Se fosse corretto il tutto mi spiegate passo passo come usare easyphp per testarlo? Perchè ho messo il file .html nella directory www...ho caricato il database...e poi?
Grazie a chi vorrà aiutarmi