Any number of ways. E.g. always set src to a php script and just add the image's id from the DB as a query parameter for the browser's get request and let your php script serve the image, or put the id in the alt tag of the image, or in the id tag (making certain it doesn't clash with any other id) or adding a new attribute for images, such as imageid (and updating your doctype specification accordingly so you don't break validation), or just keep id_pathtopic in the value attirbute of the option elements, and then parse out the part you need.