i have code to create a select list.

this select list is populated by db query

i have two pieces of code i need looked at to fix the problem

Code:
echo "<select name='LearnedJutsus' id='YourJutsu' onchange='return jutsu()' >";

	foreach($learnedJutsuInfo as $v)
	{

		echo "<option  value='$v'>$v</option>";


	}
	echo "</select></form>";

and
most importantly this one!

Code:
var selection=document.getElementById("x").options[document.getElementById("x").selectedIndex].value;
i did not write the above code it was donated to me but it seems to be not working correctly.

what i need is an explanation on how it works (which would be best since im foggy with jscript)or a fix for it

i basically need it to grab the selected option's information for later use in the program. this is a pivotal part of the system

any help appreciated.