I am trying to resubmit my webpage through javascript based on the results of a change to a drop down menu. The drop down menu is created through an SQL query.
HTML/PHP
<td> Workorder/IO: <select id = "WOIODD" name="WO/IO" onchange="getVal()">
<?php
foreach($WoIo as $workorder)
{
echo '<option>'.$workorder.'</option>';
}
?>
</select>
</td>
</tr>
<?php $currentWo=($_GET['cwo']); ?>
JAVASCRIPT
function getVal()
{
var currentVal = document.getElementById('WOIODD').value;
location.href="?cwo="+currentVal;
}
The problem is document.getElementById.value is returning nothing. The value IS NOT null, but nothing is being returned. When I tried to fix the javascript, alert(currentVal) displayed a blank box, even after it was run conditionally with no null value. I need to be able to run another query based on the option chosen in the Work Order dropdown menu.
Any ideas on why this happening, how to fix, or even an alternative method all together?
Thank you, Joshua