Search engine

Question by shortpc89:
Using a database variable inside an option value in a drop down box?

I want to put a drop-down box on my gaming site. The user will be able to click on the box and the box will drop down and show a list of games that are in the database. Each game listed in the box will have a link to it. The link will be generated based on the ID of the game in the database.

At the moment, the code I have right now is this:

The Javascript:

The dropdown box:

  • The problem is that when it shows up on my site, the actual names of the games do not show up. Instead the code shows up. For instance, ” .$ row['gameName']. ” will loop itself over and over again int he menu and the link, when clicked on, will look like this: http://www.mmocraze.com/game-directory/game-profile/?gameId=” .$ row[

    Here's the code my friend sent me (without the javascript and action page (haven't tried it yet):

    $ sql = "SELECT gameId, gameName FROM game ORDER BY gameName";
    $ result = mysql_query($ sql);

    while($ row = mysql_fetch_array($ result))
    {

    $ gameId = $ row['gameId'];
    $ gameName = $ row['gameName'];

    print(”

    “);

    }

    ?>

    Can anyone help me with this?


    ——————————————

    Answer by Riley
    this is usually because you have not shut with a ” or ‘ can you link me?

    ——————————————
    Give your own answer to this question below!