I want to add an image in select option in HTML with PHP.
The image is first fetched from a database.
echo '<option value='.$ifet['productimage'].'><img src='.$ifet['productimage'].'/></option>';
I want to add an image in select option in HTML with PHP.
The image is first fetched from a database.
echo '<option value='.$ifet['productimage'].'><img src='.$ifet['productimage'].'/></option>';
images don't work in select infact any type of CSS is not supported in select except line-height and border you can use jquery:
here is a demo: http://designwithpc.com/Plugins/ddSlick#demo
To add images in a select list you'll have to add them as a background-image.
<select>
<option value='displayvalue' style='background-image:url(".print $ifet['productimage'].");'></option>
</select>
or use it as CSS
select option[value='displayvalue']
{background-image:url(".print $ifet['productimage'].");}
Try this
<option value="<?=$ifet['productimage']?>"><img src="<?=$ifet['productimage']?>" /></option>
OR
<option value="<?php echo $ifet['productimage']; ?>"><img src="<?php echo $ifet['productimage']; ?>" /></option>