Mysql data with javascript
<p>I want to have the following thing.</p>

<p>When a particular option is selected in one drop down box,based on that selected value the option's values should change on another dropdown box...
Using javascript would be preferabe.</p>

<p>I have checked the related on the site but is however not working for me...</p>

<p>Thankyou...<br>
Edited</p>

<p>I want to have the following thing.</p>

<p>When a particular option is selected in one drop down box,based on that selected value the option's values should change on another drop-down box.
Using JavaScript would be preferable.</p>

<p>I have checked the related on the site but is however not working for me.</p>

<pre><code>&lt;select name="branch" id="branch" onchange="refresh()"&gt;
                    &lt;option value=""&gt;Select...&lt;/option&gt;
                    &lt;option value="CE"&gt;CE&lt;/option&gt;
                    &lt;option value="IT"&gt;IT&lt;/option&gt;
                    &lt;option value="EC"&gt;EC&lt;/option&gt;
                    &lt;/select&gt;
                    &lt;/td&gt;
                    &lt;td&gt;&lt;input type="text" name="project_id"&gt;&lt;/td&gt;
                    &lt;td&gt;TO&lt;/td&gt;
                    &lt;td&gt;
                    &lt;div class="container"&gt;
                        &lt;div class="CE"&gt;
                            &lt;?php                   
                            $qry="select `Userid` from `student_details` where `Branch`='CE'";
                            $rst = mysql_query($qry);
                            confirm_query($rst);    
                            echo "&lt;select name=\"user_id\"&gt;";
                            echo "&lt;option value=''&gt;Select...&lt;/option&gt;";
                            while($res = mysql_fetch_array($rst))
                            {
                                echo "&lt;option value='$res[0]'&gt;$res[0]&lt;/option&gt;";
                            }
                            echo "&lt;/select&gt;";
                            ?&gt;
                        &lt;/div&gt;
                        &lt;div class="IT"&gt;
                            &lt;?php                   
                            $qry="select `Userid` from `student_details` where `Branch`='IT'";
                            $rst = mysql_query($qry);
                            confirm_query($rst);    
                            echo "&lt;select name=\"user_id\"&gt;";
                            echo "&lt;option value=''&gt;Select...&lt;/option&gt;";
                            while($res = mysql_fetch_array($rst))
                            {
                                echo "&lt;option value='$res[0]'&gt;$res[0]&lt;/option&gt;";
                            }
                            echo "&lt;/select&gt;";
                            ?&gt;
                        &lt;/div&gt;
                        &lt;div class="EC"&gt;
                            &lt;?php                   
                            $qry="select `Userid` from `student_details` where `Branch`='EC'";
                            $rst = mysql_query($qry);
                            confirm_query($rst);    
                            echo "&lt;select name=\"user_id\"&gt;";
                            echo "&lt;option value=''&gt;Select...&lt;/option&gt;";
                            while($res = mysql_fetch_array($rst))
                            {
                                echo "&lt;option value='$res[0]'&gt;$res[0]&lt;/option&gt;";
                            }
                            echo "&lt;/select&gt;";
                            ?&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
</code></pre>

<p>And the javascript is as below</p>

<pre><code>    function refresh(){
$(document).ready(function () {
    $('#branch').bind('change', function () {
        var elements = $('div.container').children().hide(); // hide all the elements
        var value = $(this).val();

        if (value.length) { // if somethings' selected
            elements.filter('.' + value).show(); // show the ones we want
        }
    }).trigger('change'); // Setup the initial states
});
}
</code></pre>

<p>But with this i am getting three drop boxes and the values in all the drop boxes and not on the basis of the selected value.i want to display only one dropbox with different content based on the selected value in first drop box. </p>
