Student marks report
////////////////Select the student marks and put it in array with subject id and exam id 

$result = mysql_query("SELECT * FROM stu_marks");  
while ($row= mysql_fetch_array($result)){ 
$arr[$row['Subj_ID']][$row['Exam_ID']]=$row['Grade']; 
} 


I don't fully understand why you are pulling data out of an array to put it back into an array.  You should consider writing better, more specific sql queries so that the result of the individual SQl query is as close to what you want your table to look like as possible.  From there, you can then loop through the already made (via mysql_fetch_array) result and reduce the amount of redundancy.  

Also, use PDO, don't use or die (probably not ready for these two yet) and for the love of god, NAME YOUR VARIABLES DESCRIPTIVELY.  I can barely tell whats going on and it's not in any way complicated.