Dynamic drop down is not working
<p>i want to implement a dynamic drop down which will select , batch of students from first drop down and then the corresponding subjects as the options for second drop down .. </p>

<p>this is the code for my Page :</p>

<pre><code>&lt;head&gt;
&lt;link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" /&gt;
&lt;script type="text/javascript" src="jsDatePick.min.1.3.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
    });
};
&lt;/script&gt;
&lt;/head&gt;
&lt;?php
$dept =$_COOKIE[dept];
include_once("../Include/connectdb.php");
include_once("../Include/data_menu.php");
include_once '../Include/pagemaker.php';

?&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function()
{
$(".batch").change(function()
{
var id=$(this).val();
var dataString = 'year_join='+ id;

$.ajax
({
type: "POST",
url: "ajax_subject.php",
data: dataString,
cache: false,
success: function(html)
{
$(".subject").html(html);
} 
});

});
});
&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;fieldset class="cbox"&gt;&lt;legend&gt;Batch&lt;/legend&gt;
&lt;form name="frm" action=&lt;?php print "edit_attendencePHP_NEW.php"; ?&gt; method="GET"     

id="content"&gt;
&lt;br&gt;&lt;br&gt;

&lt;div style="margin:80px"&gt;
&lt;label&gt;Batch :&lt;/label&gt; &lt;select name="batch"&gt;
&lt;option selected="selected"&gt;--Select Batch--&lt;/option&gt;
&lt;?php
    $result = mysql_query("select distinct year_joining from student_profile  

order by year_joining ")or die(mysql_error());

while($year = mysql_fetch_assoc($result)){
if($year[year_joining]!="" &amp;&amp; $year[year_joining]&gt;"2008"){
  print "&lt;OPTION value='$year[year_joining]'&gt;$dept $year[year_joining]&lt;/OPTION&gt;";
}  }
 ?&gt;

&lt;/select&gt;
&lt;label&gt;Subject :&lt;/label&gt; &lt;select name="subject" class="subject"&gt;
&lt;option selected="selected"&gt;--Choose Subject--&lt;/option&gt;

&lt;/select&gt;



    Date :&lt;input type="text" size="12" id="inputField" name="date"/&gt;
        &lt;input class="bluebutton" type="submit" value="Go"&gt;    
 &lt;/form&gt;&lt;br&gt;

 &lt;label class="comment"&gt;select a batch frm the list and press "Go"&lt;/label&gt;
 &lt;/fieldset&gt; 
</code></pre>

<p>the second ajax page works fine ... as i tested that with ($_GET)</p>

<p>this is wat with $_GET[year_join] ( view source code ) shows ...</p>

<p>ajax_subject.php</p>

<pre><code>&lt;option value="ENGG.MATHS-I"&gt;ENGG.MATHS-I&lt;/option&gt;&lt;option value="COMPUTER PROGRAMMING   
LAB"&gt;COMPUTER PROGRAMMING LAB&lt;/option&gt;&lt;option value="WORKSHOPS"&gt;WORKSHOPS&lt;/option&gt; 
&lt;option value="ENGG.PHYSICS"&gt;ENGG.PHYSICS&lt;/option&gt;&lt;option  
value="ENGG.CHEMISTRY"&gt;ENGG.CHEMISTRY&lt;/option&gt;&lt;option ...........
</code></pre>

<p>Everything else seems fine ..</p>
