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:
form name=tester action=script.php method=get
select name=color
?
$sql = SELECT color_id, color FROM colors_table ORDER BY id;
$result =
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
Something like this should work:
after mysql_connect() and mysql_select_db() ...
$sql = "SELECT color_id,color FROM mytable";
$result = mysql_query($sql);
echo 'form blah,blah,blah';
echo 'select name="color_id"';
while ($row = mysql_fetch_array($result)){
printf("option
3 matches
Mail list logo