How to get the html Select value in php?
i have made this Select in html
<select id="year" onchange="filterYear();">
</select>
Function to fill in the Select:
var n = 22;
function selectOne() {
var select = document.getElementById('year');
for (var i=5; i<n; i++) {
select.options[select.options.length] = new Option(i+1, i);
}
}
but i need to read the current selected item from the select.
i tried this (javascript):
function filterYear() {
var e = document.getElementById('year');
var value = e.value;
var text = e.options[e.selectedIndex].text;
alert(text);
}
php:
$text = $_GET['text'];
echo $text;
but this did not work any ideas on how to fix this
i hope someone can push me in the right direction