|
So glad you brought up the switch.
If the confirmkey matches the filename you could also use:
$soundfile = !empty($confirmkey) ? 'sounds/'.$confirmkey.'.mp3' : 'none';
Or with an array check:
$validkeys = array('blue','red','yellow',...);
$soundfile = !empty($confirmkey) && in_array($confirmkey, $validkeys) ? 'sounds/'.$confirmkey.'.mp3' : 'none';
|