Possible Duplicate:
How to get the selected value of dropdownlist using JavaScript?
I have a drop down list box, whose entries are dynamically populated from mysql using php.
Here is the snippet.
<?php
//include '../db/interface/DB_Manager.php';
$connect = mysql_connect("localhost", "root", "infinit") or die(mysql_error());
mysql_select_db("serverapp") or die(mysql_error());
$query = "select id,name from rpt_shift_def"; //Write a query
$data = mysql_query($query); //Execute the query
?>
<select id="selectShift" name="selectShift" onchange="ready(this.value)">
<?php
while($fetch_options = mysql_fetch_array($data)) { //Loop all the options retrieved from the query
?>
<option id ="<?php echo $fetch_options['id']; ?>" value="<?php echo $fetch_options['name']; ?>"><?php echo $fetch_options['name']; ?></option><!--Echo out options-->
<?php
}
?>
</select>
Now i want the values in the option id's to pass it to the Mysql query to use those values as filters(those ID's are UUID of Mysql used here as Primary Keys).
If the id's are static i can use document.getElementById("ID"); to get those values, since it was PHP echo's, i can not use document.getElementById().
How to get the values in echo'ed in the ID in Javascript.