Hi ,
 I need a calculation method to calculate multiple marks for an Individual students.

 Based on standard id and section id  I showed list of students, and subjects dynamically,
 so that, for each student n number of subjects will display.

 When entering marks, for each student and for all subjects of him, it has to calculate the total, and has to display in total field at the end of each row for all students.

 I do not know how to do this function. I need your help to solve this.

 Here I included my code to you


 My sample Code:
 <table class="display" id="example" width="100%" border="1" cellpadding="0" cellspacing="1" bgcolor="#000033" style="border:1px #000066 solid; text-align:center;" >
<thead>
<tr>
<td height="30" width="2%" bgcolor="#1A4779" class="white_bold" >S.No</td>
<td bgcolor="#1A4779" width="8%" class="white_bold">Student Name</td>

<?php 
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
<td bgcolor="#1A4779" width="10%" class="white_bold"><?php echo $jjsublist_res['subject_name'];?></td>
<?php 
    }
 ?>
<td bgcolor="#1A4779" width="5%" class="white_bold">Total</td>
</tr>
</thead>
    <tbody>
 <?php
 $jj = 1;
 while($jjsub_res = mysql_fetch_array($jjsub))
    {
 ?>
      <tr bgcolor="#FCFAF7" class="jjanto">
            <td><?php echo $jj;?></td>     
            <td><?php echo $jjsub_res['Name'];?></td>
           <?php     
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
             <td><input type="text" name="subject" id="subject" class="subjectmark" size="5" maxlength="3" /></td> <?php } ?>   
            <td><input type="text" name="calctotal" id="calctotal" onclick="calculate_Duration(this);" class="joeljowintotal" readonly="readonly"  size="10"/></td>        
      </tr>
    </tbody>
    <?php
            $jj++;
        }
    }
    ?>

</table>

 I need your full help to solve this, 
 I am fully empty

First of all, insert your code example inside code blockes, as in
My sample Code:

<table class="display" id="example" width="100%" border="1" cellpadding="0" cellspacing="1" bgcolor="#000033" style="border:1px #000066 solid; text-align:center;" >
<thead>
<tr>
<td height="30" width="2%" bgcolor="#1A4779" class="white_bold" >S.No</td>
<td bgcolor="#1A4779" width="8%" class="white_bold">Student Name</td>
<?php 
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
<td bgcolor="#1A4779" width="10%" class="white_bold"><?php echo $jjsublist_res['subject_name'];?></td>
<?php 
    }
 ?>
<td bgcolor="#1A4779" width="5%" class="white_bold">Total</td>
</tr>
</thead>
    <tbody>
 <?php
 $jj = 1;
 while($jjsub_res = mysql_fetch_array($jjsub))
    {
 ?>
      <tr bgcolor="#FCFAF7" class="jjanto">
            <td><?php echo $jj;?></td>     
            <td><?php echo $jjsub_res['Name'];?></td>
           <?php     
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
             <td><input type="text" name="subject" id="subject" class="subjectmark" size="5" maxlength="3" /></td> <?php } ?>   
            <td><input type="text" name="calctotal" id="calctotal" onclick="calculate_Duration(this);" class="joeljowintotal" readonly="readonly"  size="10"/></td>        
      </tr>
    </tbody>
    <?php
            $jj++;
        }
    }
    ?>
</table>

Next, you are breaking the rule of good php programming - do NOT mix output with your php code. Use the php code to generate the entirety of the HTML output. It works very easily that way. Then you just have to output the resulting HTML string from the php variable you stored it in.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.