Re: Populating a dropdown listbox from a database?

From: Date: Mon, 16 Oct 2000 11:57:54 +0000
Subject: Re: Populating a dropdown listbox from a database?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-20350@lists.php.net to get a copy of this message
Subject: Re: [PHP] How can I include mysql-query results as <options> in a html-skript? Date: 9 Oct 2000 07:32:44 -0700 From: baeb@yournet.be (Stefan Goethals) Newsgroups: php.general References: 1 Joachim Ritzer wrote: > > hi everybody, > > Since a few days I try to include the result of a MySQL-query as options > into html-skript. I know this sentence is not very precise, but if you may > take a look on the following lines (see <OPTION>) you will know what I´m > talking about. > > <? > $query = ("SELECT matrikelnummer FROM diplomanden ORDER BY matrikelnummer"); > $result = mysql_query($query, $db); > $number = mysql_num_rows($result); > $matrikelnummer = mysql_fetch_array($result,MYSQL_NUM); > ?> > ... > <TR> > <TD bgColor=#ffe4b5>Matrikelnummer:</TD> > <TD><SELECT id="" name=matrikelnummer > style="HEIGHT: 22px; WIDTH: 150px"> <?php while ($result = mysql_fetch_object($qid)) { $output .= "<option value=\"" . $cat->matrikelnummer . "\">" . $cat->matrikelnummer; } ?> > </SELECT> I didn't test this modified bit of code, but the principle works. -- Stefan - Zipkid - Goethals YourNet - Open source web design & Site management. http://www.yournet.be mailto:stefan@yournet.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#20350) next »