0
    <? 
    ... 
    mysql cnx code 
    ... 

    $sql="SELECT id, thing FROM table"; 
    $result=mysql_query($sql); 

    $options=""; 

    while ($row=mysql_fetch_array($result)) { 

        $id=$row["id"]; 
        $thing=$row["thing"]; 
        $options.="<OPTION VALUE=\"$id\">".$thing; 
    } 
    ?> 

... 
html code 
... 

<SELECT NAME=thing> 
<OPTION VALUE=0>Choose 
<?=$options?> 
</SELECT> 

I'm using the above code to generate a drop down from my mysql database, but i also want an image in front of every text in the drop down list.

For example: I have 4 things - APPLE, MANGO, BANANA, CARROT and the images are stored in a folder and their path is saved in a database table field. All i want to do is to add the respective image along with the text.

Thanks in advance

Matteus Hemström
  • 3,796
  • 2
  • 26
  • 34
user1731476
  • 125
  • 3
  • 10

0 Answers0