<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{


include 'dbc.php';
$id=$_REQUEST["id"];
$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		
		
		 $my=$month_name . " " . $year;
		 
		
?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

    <?php include("includes/menu.php") ?><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/headermenu.php") ?>

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                        <div class="card">
                            <div class="card-header"><strong>Enter Obtained Marks</strong><small> Form</small></div>
                            <div class="card-body card-block">
							
							 <?php
include 'dbc.php';

$term=$_POST["term"];
$month_name=$_POST["month_name"];
$sess1=$_POST["sess1"];
$class_name=$_POST["class_name"];
$cls_sec=$_POST["cls_sec"];
$userid=$_SESSION["userid"];
$asses=$_POST["asses"];
$today=date("Y-m-d");
echo $asses;
$sql = "SELECT * FROM result where  term='$term' and asses='$asses' and sess1='$sess1' and class_name='$class_name' and month_name='$month_name' and user_id='$userid' order by id";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$class_name=$row['class_name'] ;

$sub1=$row['sub1'] ;
$sub2=$row['sub2'] ;
$sub3=$row['sub3'] ;
$sub4=$row['sub4'] ;
$sub5=$row['sub5'] ;
$sub6=$row['sub6'] ;
$sub7=$row['sub7'] ;
$sub8=$row['sub8'] ;
$sub9=$row['sub9'] ;
$sub10=$row['sub10'] ;


$sqlrec = "SELECT * FROM result where  term='$term' and asses='$asses' and sess1='$sess1' and class_name='$class_name' and month_name='$month_name' and user_id='$userid' ORDER BY std_rollno";
$resultrec=$conn->query($sqlrec);
 
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
echo "<tr>";
echo "<th colspan=4><center> $term  </center> </th>";
echo "<th colspan=2><center> $month_name  </center> </th>";
echo "<th colspan=2><center> $sess1 </center> </th>";
echo "<th colspan=2><center> $class_name</center> </th>";
echo "<th colspan=2><center> $cls_sec</center> </th>";
echo "</tr>";
echo "<tr>";
echo "<th > id</th>";
echo "<th > Adm# </th>";
echo "<th > Student Name </th>";
echo "<th > Father Name </th>";
echo "<th > $sub1</th>";
echo "<th > $sub2</th>";
echo "<th > $sub3</th>";
echo "<th > $sub4</th>";
echo "<th > $sub5</th>";
echo "<th > $sub6</th>";
echo "<th > $sub7</th>";
echo "<th > $sub8</th>";
echo "<th > $sub9</th>";
echo "<th > $sub10</th>";
echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
echo "<form name='form_update' method='post' action='Update_Result.php'>\n";
while($students = $resultrec->fetch_assoc()) {

	echo '<tr>';
	
	echo "<td>{$students['id']}<input type='hidden' name='id[$i]' value='{$students['id']}' /></td>";
	echo "<td>{$students['std_rollno']}<input type='hidden' name='std_rollno[$i]' value='{$students['std_rollno']}' /></td>";
	echo "<td>{$students['std_name']}<input type='hidden' name='std_name[$i]' value='{$students['std_name']}' /></td>";
	echo "<td>{$students['father_name']}<input type='hidden' name='father_name[$i]' value='{$students['father_name']}' /></td>";
	echo "<td><input type='text' size='3' name='omark1[$i]' value='{$students['omark1']}'/><br><input type='text' size='3' name='tmark1[$i]' value='{$students['tmark1']}'/></td>";
	echo "<td><input type='text' size='3' name='omark2[$i]' value='{$students['omark2']}'/><br><input type='text' size='3' name='tmark2[$i]' value='{$students['tmark2']}'</td>";
	echo "<td><input type='text' size='3' name='omark3[$i]' value='{$students['omark3']}'/><br><input type='text' size='3' name='tmark3[$i]' value='{$students['tmark3']}'</td>";
	echo "<td><input type='text' size='3' name='omark4[$i]' value='{$students['omark4']}'/><br><input type='text' size='3' name='tmark4[$i]' value='{$students['tmark4']}'</td>";
	echo "<td><input type='text' size='3' name='omark5[$i]' value='{$students['omark5']}'/><br><input type='text' size='3' name='tmark5[$i]' value='{$students['tmark5']}'</td>";
	echo "<td><input type='text' size='3' name='omark6[$i]' value='{$students['omark6']}'/><br><input type='text' size='3' name='tmark6[$i]' value='{$students['tmark6']}'</td>";
	echo "<td><input type='text' size='3' name='omark7[$i]' value='{$students['omark7']}'/><br><input type='text' size='3' name='tmark7[$i]' value='{$students['tmark7']}'</td>";
	echo "<td><input type='text' size='3' name='omark8[$i]' value='{$students['omark8']}'/><br><input type='text' size='3' name='tmark8[$i]' value='{$students['tmark8']}'</td>";
	echo "<td><input type='text' size='3' name='omark9[$i]' value='{$students['omark9']}'/><br><input type='text' size='3' name='tmark9[$i]' value='{$students['tmark9']}'</td>";
	echo "<td><input type='text' size='3' name='omark10[$i]' value='{$students['omark10']}'/><br><input type='text' size='3' name='tmark10[$i]' value='{$students['tmark10']}'</td>";
	
	 
	echo '</tr>';
	++$i;
}
?>

								
		
                                                    </div>
													<div class="card-footer">
                                                       <?php
echo '<tr>';
echo "<td><input type='submit' value='Genrate' /></td>";

echo '</tr>';
echo "</form>";
echo '</table>';
?>
                                                       
                                                    </div>
													
													
                                                </div>
                                            </div>

            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
?>