[ Re: [PHP-DB] Filling Drop-Down Box.]
| From: | Alexandru Mihai | Date: | Sat, 25 Dec 2004 21:57:51 +0000 |
| Subject: | [ Re: [PHP-DB] Filling Drop-Down Box.] | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-37853@lists.php.net to get a copy of this message | ||
<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 bastienFrom: Nayyar Ahmed <nayyares@gmail.com> Reply-To: Nayyar Ahmed <nayyares@gmail.com> 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 , 9217452Cell : 92-0333-9139461-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php