Hi everyone,
I'm trying to get a pull down list with info out of my database.
This list is a "country" where a airport is based.
Right now I'm getting double and empty entries. can I fix this??
Thanx: here's my script:
Jacco
<?PHP
$link = mysql_connect();
$db=test;
//connect section:
if (! $link)
die( "couldn't connect");
mysql_select_db($db)
or die ("won't open test:".mysql_error() );
//html start:
print "<html>\n";
print "<head>\n";
print "<title>Untitled Document</title>\n";
print "</head>\n";
print "<body id=theBody onload=parent.showPage('main')>\n";
//db entries count:
$count = mysql_query("SELECT * FROM aaa");//selects all rows
$total = mysql_num_rows($count);//counts the selected rows
print "There are a total of $total Airlines listed in the database\n";//displays the counted number
//form start:
print "<form method=GET action=my3.php>\n";
print " <input type=text name=icao>\n";
print " <input type=text name=name>\n";
//Select list:
$query = "SELECT Field3 FROM aaa ORDER BY id";
$result = mysql_query($query) or die("Error in query");
print "<select name=country>";
while($row = mysql_fetch_assoc($result))
{
print "<option>".$row['Field3']."</option>\n";
}
print "</select>";
//rest of form:
print " <input type=submit value=Hit it!>\n";
print " <input type=radio name=ton value=AND checked>and\n";
print " <input type=radio name=ton value=OR>or\n";
print "</form>\n";
print "<hr>\n";
//end html
print "</body>\n";
print "</html>\n";
?>