Re: [PHP] newbie PHP/HTML pull down menu problem
You have a while loop that pulls values out of the MySQL table row by row, and for each row, you output an option in the select box. Something like: {$color}"; } ?> Season to taste :) Justin French on 14/08/02 2:30 PM, Brian & Shannon Windsor ([EMAIL PROTECTED]) wrote: > 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 > > > > red > blue > black > ice > purple > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie PHP/HTML pull down menu problem
Something like this should work: after mysql_connect() and mysql_select_db() ... $sql = "SELECT color_id,color FROM mytable"; $result = mysql_query($sql); echo ''; echo ''; while ($row = mysql_fetch_array($result)){ printf("",$row["color_id"]); printf("%s",$row["color"]); } echo ''; echo ''; HTH, - E PS Check the manual for printf() if you're not sure how it works... http://www.php.net/manual/en/function.printf.php > >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 > > > > red > blue > black > ice > purple > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ きっと見つかるあなたの新居 不動産情報は MSN 住宅で http://house.msn.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie PHP/HTML pull down menu problem
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 red blue black ice purple -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php