I’ve got a drop down menu that is used to select different cd’s by a musician. That is done using this:
<select id="opt" name="opt" class="input_select" style="width: 150px;">
<?php foreach( $musician as $key=>$value ) { ?>
<option value="<?php echo $value['id'] ?>"><?php echo htmldisplay( $value['name'] ) ) ?></option>
<?php } ?>
</select>
I want different things to be shown depending on the option selected. I’m using this to choose what is shown, but that only works once.
<?php
if( is_array( $musician ) ) {
echo getcdtstock( $musician[0]['id'] );
} else {
switch( $cds_all[$dynaload]['stock_status'] ) {
case 1: echo "<input class="input_button input_basket input_green" type="submit" value="Add to basket" />"; break;
case 3: echo "<span style=\"color: #bfbfbf;\">Sorry, this cd is temporarily out of stock</span>"; break;
case 4: echo "<span style=\"color: #cc2a41;\">Sorry we no longer stock this cd</span>"; break;
}
}
?>
I want it to change when different cd’s are selected but don’t know how to change that.
I’d be extremely grateful for any help with this. I know I need to use JavaScript but don’t know too much about it.