I have a form that I use JavaScript
to set the value of a hidden INPUT field
which is the text of the OPTION selected
. The $_POST
captures the value of the OPTION
but not the value of the hidden INPUT
. The hidden INPUT
is being used to pass the OPTION
text so it is available in the $_POST
array
.
This is the section of JavaScript used to get the value and text of the selected OPTION
var sele = document.getElementById('building_type');
var seleVal = sele.options[sele.selectedIndex].value;
var seleTxt = sele.options[sele.selectedIndex].text;
This is where I set the value of the INPUT field with an ID of "other_hidden_text" in the same JavaScript.
document.getElementById("other_hidden_text").value = seleTxt;
My problem is $_POST['other_hidden_text']
is empty. Any ideas why?