View Single Post
  #2 (permalink)  
Old June 23rd, 2006, 10:46 PM
richard.york's Avatar
richard.york richard.york is offline
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Maybe you're having trouble finding tutorials because you don't know the right terms to query!

Assuming you know how to connect to the database, you'd populate a <select> element like so,
Code:
$query = mysql_query(
    "SELECT `uniqid`, 
            `firstname`,
            `lastname`
       FROM `tablename`
   ORDER BY `lastname` ASC"
);

echo "<select name='people'>\n";

while ($data = mysql_fetch_array($query, MYSQL_ASSOC))
{
    echo "    <option value='{$data['uniqid']}'>{$data['lastname']}, {$data['firstname']}</option>\n";
}

echo "</select>\n";
See, pretty easy stuff. Let me know if you have any questions.

HTH!

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
Reply With Quote