Looking for some help on how to accomplish the following:
Currently populating a select box based on values in a mysql database.
// create SQL statement for YEARS
$years_sql = "SELECT distinctrow year FROM races where workout_type = 'Race'";
// execute SQL query and get result
$years_sql_result = mysql_query($years_sql,$con)
or die("Couldn't execute query.");
// put data into ARRAY box FOR years select box
while ($rowY = mysql_fetch_array($years_sql_result))
{
$years = $rowY[year];
$years_block .= "<OPTION VALUE=\"$years\">$years</OPTION>";
}
echo "<Select name=yearsel>";
echo $years_block;
echo "</select>";
echo " and ";
I want to have the option to select a value of "ALL YEARS", this DOES NOT exist in the database. I plan to have this selection kick off another set of SQL code.
So... how do I get the value of "ALL YEARS" into a select box that is dynamically populated from a table where the value doesn't exist??
Appreciate the input!!!