I have 2 drop down. In 2nd drop down items are added dynamically based on 1st drop down selection.
Now I want selected value of 5th subject to store in MySQL table. I am not able to get the value of option which is selected in 2nd drop down.
How can I get that selected value as the items are dynamically added in option tag
here is the code
<script>
function SetSubject(objLanguage) {
var objMedia = document.getElementById("5thsub");
objMedia.options.length = 0;
objMedia.disabled = false;
switch (objLanguage.value) {
case "Humanity":
objMedia.options.add(new Option("Hindi"));
objMedia.options.add(new Option("IP"));
break;
case "Commerce":
objMedia.options.add(new Option("IP"));
objMedia.options.add(new Option("Other"));
break;
case "Sci[PCM]":
objMedia.options.add(new Option("CS"));
objMedia.options.add(new Option("IP"));
break;
case "Sci[PCB]":
objMedia.options.add(new Option("IP"));
objMedia.options.add(new Option("Math"));
break;
default:
objMedia.options.add(new Option("select"));
objMedia.disabled = true;
break;
}
}
</script>
<tr>
<td>Stream :
<select name="stream" id="stream" onchange="SetSubject(this)">
<option> Select</option>
<option value="Humanity">Humanity</option>
<option value="Commerce">Commerce</option>
<option value="Sci[PCM]">Sci[PCM]</option>
<option value="Sci[PCB]">Sci[PCB]</option>
</select>
</td>
<td>5th Subjects :
<select name="5thsub" id="5thsub" disabled="disabled">
<option>Select</option>
</select>
</td>
</tr>
Thank you in advance to all experts