I have poured over these and other forums, but can't find out what I'm doing wrong. I've found a few threads that deal with what I'm trying to do, but they didn't fix the problem.
What I'm trying to do is populate a drop down list based on info in my mysql database table.
I have a game number id (game_ID) I want to use as the 'value', and the game name (game_name_long) that I want to use as the actual entry in the list box.
Here is the code I am using that takes the data from the db and populates the drop down list box:
/*************************************************************
print '<form action="$_SERVER[PHP_SELF]" method="post">';
print '<select name="games">';
while ($db_data = mysql_fetch_array($result)) {
$game_ID = $db_data['game_ID'];
$game_name_long = $db_data['game_name_long'];
print '<option value="$game_ID">$game_name_long</option>';
}
print '</select>';
print '</form>';
*************************************************************/
I've also tried using concatination with the variables, like this:
/*************************************************************
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
print '<select name="games">';
while ($db_data = mysql_fetch_array($result)) {
$game_ID = $db_data['game_ID'];
$game_name_long = $db_data['game_name_long'];
print '<option value="' . $game_ID . '">' . $game_name_long . '</option>';
}
print '</select>';
print '</form>';
*************************************************************/
I'm not sure what I'm doing wrong here. I have used print statements to make sure that mysql_fetch_array() is pulling the data correctly, and it is.
Any suggestions?