The following script works great, except it will only display odd years (i.e. 1991, 1993, and so on). If I select an even year from the drop down menu I get nothing, no error message or data. Any idea why this would happen.
****Drop Down Menu****
<FORM NAME="form" action="year.php" method="get">
<SELECT NAME="site" size=1 onChange="javascript:jumpBox()">
<OPTION VALUE="">Class of.....
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1980">1980
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1981">1981
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1982">1982
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1983">1983
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1984">1984
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1985">1985
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1986">1986
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1987">1987
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1988">1988
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1989">1989
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1990">1990
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1991">1991
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1992">1992
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1993">1993
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1994">1994
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1995">1995
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1996">1996
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1997">1997
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1998">1998
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=1999">1999
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=2000">2000
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=2001">2001
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=2002">2002
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=2004">2003
<OPTION VALUE="http://www.mysite.com/index.php?s=alumni-database&year=2004">2004
</SELECT>
</FORM>
***script***
<?php
//Log on to Database
$host = "localhost";
$user = "username";
$pass = "pass";
$dbname = "db name";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
//query for data from class field
$year = $_GET['year'];
$result = mysql_query("SELECT * FROM address WHERE Class='$year'");
if ($header = mysql_fetch_array($result)) {
//create table
echo "<table align=center border=0 cellpadding=0 cellspacing=0>\n";
printf( "<tr><td align=center><strong>%s</strong><hr></td></tr>\n", $header["Class"]);
do {
//write data from class field to new table
printf("<tr><td align=center><br>%s %s</td></tr>\n", $header["First"], $header["Last"]);
} while ($header = mysql_fetch_array($result));
//if there is no data in the db user will get this error
} else {
printf( "Sorry, no one from<strong> $year </strong>has registered in the alumni database\n", $header["Class"]);
echo "</table>\n";
}
?>
********