<?php//connection to the database $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("expertiselist",$dbhandle) or die("Could not select database!"); // end of db connection ?> <form name=form action="output.php" method="post"><?php $query = "SELECT distinct name FROM list"; $result = mysql_query($query); print "<SELECT name=attorney>"; while ($line = mysql_fetch_array($result)) { foreach ($line as $value) { print "<OPTION value='$value'"; } print ">$value</OPTION>"; } mysql_close($link); print "</SELECT>"; // free the result mysql_free_result($result); ?> <input type="submit" value="submit"> </form>