I have to pass an array index to php loop onChange event
<select class='services' name="services" onChange="changeforservice(this.value);" >
<option value="Treatment1 " selected>Treatment1</option>
<option value="Treatment2">Treatment2</option>
<option value="Treamtment3">Treamtment3</option>
</select>
JavaScript to get srevices value :
<script>
function changeforservice(val){ }
</script>
Now I have sub-services array against each service selected as below
$data = array(
'Treatment1' => array(
'option 1',
'option 2',
),
'Treatment2' => array(
'option 1',
'option 2',
),
);
on change event I want to pass data index as below
<?php foreach($data['selectedindex'] as $value):?>
<?php echo $value; ?>
<?php endforeach;?>
how do I pass the selected index value on change event.
Please help.