<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

From: Nayyar Ahmed <[EMAIL PROTECTED]>
Reply-To: Nayyar Ahmed <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] Filling Drop-Down Box.
Date: Sat, 25 Dec 2004 20:18:05 +0500

Hello All,

I want to fill drop-down box from mysql table, if any body
be kind to tell me a sample code :)
e.g:
In my application i want to gather subject list from current
semester-subject table of a student.

TIA
--
Nayyar Ahmad

Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell     :  92-0333-9139461

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to