For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > December 2004 > [ Re: [PHP-DB] Filling Drop-Down Box.]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [ Re: [PHP-DB] Filling Drop-Down Box.]
Alexandru Mihai

2004-12-27, 3:55 pm

<SELECT name="student" title="Student list">

<OPTION value="">---------------</OPTION>
<?PHP
while ($row = mysql_fetch_array($result)) {
?>
<OPTION value="<?php echo $row[3]?>" title="Select student <?php
echo $row[1]," ", $row[2]?>"> <?php echo $row[3]?></OPTION>
<?php
}
?>
</SELECT>
In this case I've assumed that you'll have in mysql the following table:
row0: id (autoincrement)
row1: Nick name
row2: First name
row3: Last name

You can modify the code as you wish to get what you need.

Alexandru Mihai


Bastien Koert wrote:

> i suggest you google for this...there are a million examples of this
> kind of code
>
> bastien
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com