so, although I don't use any of the technologies you have listed, here is what I would do, from a logic standpoint (I assume you would be doing an onload event for the sound. Regardless, just plug in your code. It should work):
- You start off by having, say, A.sound and B.sound in your file system. In your call to the file, you have a variable that holds either "A" or "B", depending on what kind of drug.
- You determine the type of drug, based on type, you assign variable "A" or "B" like so:
<?php echo $drugType; ?>.sound (where $drugType is either "A" or "B"
If you are using a database, then you get the value of the "drugType" column and again, based on type, assign the necessary variable.
That should do it. If I don't understand, break it down for me and whoever happens to read this post as well.