Re: newbie PHP/HTML pull down menu problem

From: Date: Wed, 14 Aug 2002 09:16:29 +0000
Subject: Re: newbie PHP/HTML pull down menu problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-112499@lists.php.net to get a copy of this message
In article <20020814043509.4302.qmail@pb1.pair.com>, bwindsor@mindspring.com says... > Hi, > > I want to pull information out of my mySQL database and use it as a pull > down menu ona web page. There are two sets of information that I need, one > is a color, and the other is the color_id, so I want to use it in the way > below but without having to physically enter all the data. I'd like to use > color_id as the value and the actual color name as the text in the pull down > button. Can someone please help me on how to pass the info into a useable > way to get the info out of PHP and into HTML? I've haad no problems going > from HTML to PHP, but can't seem to grasp going the other way, especially > with a list of things. I've been banging my head against this for two days, > but something tells me it's extremely easy. > > Thanks, > > Brian Just the pseudocode to give you an idea... query = Select color, colorid from table run dbquery <form name="tester" action="script.php" method="get"> <select name="color"> loop through dbresults <option value="<?php echo colorid?>"><?php echo $color?> end loop </select> </form> See the mysql functions for exampls of how to submit a query and use the results in a while loop. Cheers -- David Robley Temporary Kiwi! Quod subigo farinam

« previous php.general (#112499) next »