Dynamic Update of checkbox on php form
<p>THis is my project , i have to select the section , then acording to that , if its "A" then checkbox from 1 50 will be displayed , and if its "B" then from 51 to 100</p>

<p>this is my main code :</p>

<pre><code>&lt;html&gt;
&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;script type="text/javascript"&gt;
$(document).ready(function()
{
    $(".section").change(function()
    {
        alert('asdfa');
        var id=$(this).val();
        var dataString = 'section='+ id;

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

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

&lt;body&gt;
&lt;fieldset class="cbox"&gt;&lt;legend&gt;New Attendence System&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" class="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;Section :&lt;/label&gt; 
&lt;select name="section" class="section"&gt;
        &lt;OPTION value='A'&gt; A&lt;/OPTION&gt;
        &lt;OPTION value='B'&gt; B&lt;/OPTION&gt;
&lt;/select&gt;

  Date :&lt;input type="text" size="12" id="inputField" name="date"/&gt;

  &lt;label&gt;Hours :&lt;/label&gt; &lt;select name="hour" &gt;
        &lt;OPTION value='1'&gt; 1&lt;/OPTION&gt;
        &lt;OPTION value='1'&gt; 2&lt;/OPTION&gt;
        &lt;OPTION value='1'&gt; 3&lt;/OPTION&gt;

&lt;/select&gt;
&lt;/br&gt;&lt;/br&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;
 &lt;/br&gt;
    &lt;label&gt;Mark the Absenties : &lt;/label&gt; 
    &lt;input type="checkbox" class="section"&gt;
  &lt;br/&gt;&lt;/br&gt;
  &lt;div class="absent"&gt;&lt;/div&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;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>This is my ajax_absent.php which is working fine separately ..</p>

<pre><code>&lt;?php
include_once("../Include/connectdb.php");


if($_POST['section'])
{
$sec=$_POST['section'];
if($sec=="A")
    $j=1;
else if($sec=="B")
    $j=51;

    for($i=0;$i&lt;=49;$i++)
        { $k=$j+$i;
        if($i%5==0)
        {   echo "&lt;/br&gt;";       }   
            echo '&lt;input type ="Checkbox" value="'.$i . '"&gt;'.$k .   
 '&lt;/option&gt;';

        }



?&gt;
</code></pre>

<p>the same dynamic concept i implemented for drop down menu .. in the same file , but the check box is coming with just one check box.</p>
