I'm sure I am over complicating things but I am trying to accomplish 2 things with the referenced HTML. When user selects an option, I want to toggle the display style of the leaderTable from hidden to visible if it meets the criteria (this I have done successfully with the JS that follows)
I also want to pass the value of the selected option as an argument to a PHP function that will set a $_SESSION variable which I can use.
From my understanding I would have to use an AJAX request to communicate the value to the php script but I don't fully understand AJAX POST vs GET.
HTML
<select id="rate_type" name="rate_type">
<option value="">Select One</option>
<option value="1">Non-Supervisors</option>
<option value="2">Supervisors</option>
<option value="3">Manager</option>
<option value="4">Director</option>
<option value="5">Sales</option>
<option value="6">Executive</option>
</select>
JS
<script>
window.onload = function() {
var eSelect = document.getElementById('rate_type');
var leaderTable = document.getElementById('leadership');
eSelect.onchange = function() {
if((eSelect.selectedIndex == 2) || (eSelect.selectedIndex == 3) || (eSelect.selectedIndex == 4) || (eSelect.selectedIndex == 5) || (eSelect.selectedIndex == 6)){
leaderTable.style.display= 'block';
} else {
leaderTable.style.display = 'none';
}
}
}
</script>