SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Threaded View

  1. #1
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm trying to generate a list of drop-down list box, and each list box gets it's options from MySQL, goes something like:

    PHP Code:
    <?php

    $sql 
    mysql_query ("SELECT firstname, lastname FROM table ORDER BY lastname") or die (mysql_error());

    $i=1;
    while (
    $i<="4")
    {

        echo 
    "<select name=\"name\">";
        while (
    $row mysql_fetch_array($sql))
            {
            
    extract ($row);
            echo 
    "<option value=\"$fname $lname\">$lname$fname</option>\n";
            }
        echo 
    "</select>";

    $i++;
    }

    ?>
    I get something like:


    list box 1: Elvis Presley, Bob Marley, Bill Gates, Steve Jobs

    list box 2:

    list box 3:

    list box 4:


    Basically I get 4 list boxes, which is what I want, but only the first list box has the correct options, the others have no options at all.
    Last edited by Robo; Apr 28, 2001 at 01:29.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •