<?php session_start() ?>

<?php

    function do_alert($msg) 

    {

        echo '<script type="text/javascript">alert("' . $msg . '") 

           parent.location="portal.html";



</script>';

       

    }

?>

<?php

include('config.php');

$stu=$_POST['idty'];

$tyr=$_SESSION['num'];

$_SESSION['numi']=$stu;





$boff="t_$tyr";



$sql = "select * from `$boff` where serialno='$stu'";

$data=(mysql_query($sql)); 



$rows = mysql_num_rows($data);



if($rows <= 0){

   do_alert("user does not exist contact system admin");

}

else{



while($row= mysql_fetch_array($data))

{





$subjj=  $row['subjects'];



$claf= $row['class'];



$tya= $row['type'];





$claff="$claf$tya";



$_SESSION['claff']=$claff;

$_SESSION['subjj']=$subjj;

}





}



//make the database connection



$sql = "select regno,name,Subjects,code,weeklytest,tot from `$claff`  ";

$data=(mysql_query($sql)); 



$rows = mysql_num_rows($data);











$sql = "UPDATE `$claff` set tot=(code+weeklytest+ex) ";

						$data=(mysql_query($sql)); 



?>

<script>

	function showEdit(editableObj) {

		$(editableObj).css("background","#FF0");

	} 

	

	function saveToDatabase(editableObj,column,id) {

		$(editableObj).css("background","#009933 url(loaderIcon.gif) no-repeat right");

		$.ajax({

			url: "saveedit.php",

			type: "POST",

			data:'column='+column+'&editval='+editableObj.innerHTML+'&id='+id,

			success: function(data){

				$(editableObj).css("background","#DDD");

			}        

	   });

	}

	</script>





<!DOCTYPE html>

<!--[if IE]><![endif]-->

<!--[if IE 8 ]><html dir="ltr" lang="en" class="ie8"><![endif]-->

<!--[if IE 9 ]><html dir="ltr" lang="en" class="ie9"><![endif]-->

<!--[if (gt IE 9)|!(IE)]><!-->

<html dir="ltr" lang="en">

<!--<![endif]-->

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>online</title>



<meta name="description" content="Jasmine" />

<meta http-equiv="X-UA-Compatible" content="IE=edge">



<link href="catalog/view/javascript/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />



<link href="catalog/view/javascript/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />



<link href="catalog/view/theme/default/stylesheet/stylesheet.css" rel="stylesheet">

<link href="catalog/view/javascript/jquery/owl-carousel/owl.carousel.css" type="text/css" rel="stylesheet" media="screen" />





	<!-- bootstrap css -->

	<link rel="stylesheet" type="text/css" href="assests/bootstrap/css/bootstrap.min.css">

	<!-- datatables css -->

	<link rel="stylesheet" type="text/css" href="assests/datatables/datatables.min.css">

<style>



h1 {

  line-height:0.7em;

}

img.alignleft {

	

	float: left;

margin: 0px 0px;

border:4px solid blue;

}



img.alignleft1 {

	

	float: right;

margin: -450px 20px;

border:4px solid black;

}



</style>

</head>

<body bgcolor="#eee" class="common-home">



<header>

</br></br></br>

  <div class="container">

    <div class="row">

      <div class="container1">



<div class="row">

 

    



    <div class="col-lg-10 col-md-10 col-sm-12 col-xs-12">

     

 <img src="images/c11.jpg"  class="alignleft4" /></br></br>

      </div>

    



    <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">

</br>

  <nav id="menu" class="navbar">

    <div class="navbar-header"><span id="category" class="visible-xs">MENU</span>

      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>

    </div>

    <div class="collapse navbar-collapse navbar-ex1-collapse">



      <ul class="nav navbar-nav">

                        <li class="dropdown"><a href="licvbthstff.php">HOME</a>

        

            



         

                      



                      </ul>

    </div>

  </nav>

  

  



</div></br></br></br></br></br></br>

<div class="panel panel-default"></div>

    









</br>

<form action=score333s.php method=post>

<table><tr><td>

<h4><font color=#d9534f

>MY SUBJECTS :</font><?php

$query = mysql_query("select * from `$boff`" ) ; // Run your query



echo '<select name="idty" >'; // Open your drop down box



// Loop through the query results, outputing the options one by one

while ($row = mysql_fetch_array($query)) {

   echo '<option value="'.$row['serialno'].'">'.$row['subjects'].' '.$row['class'].' '.$row['type'].'</option>';

}



echo '</select>';// 



?></h4></td><td> <input type=submit border=0 value="Search"></td>



</form>

<div class="container">



<div class="row">



 <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">



 



   



</div>

</br>

		

				

				

				<div class="container" style="margin-top: 30px;">

		<div class="text-right col-sm-12 col-xs-12">

			

			

			

		</div>

		<div><!--Main Page--> 

		<div class="col-sm-12">

		

		

					<?php

					$ass="code";

					$ass2="weeklytest";

					$ass3="ex";

		$subj="";

					

							$id7 = @$_POST['idty'];

						 if (!isset($_POST['idty'])){

						 echo "<h3>Please submit your request</h3>";

						 } else 

						 {

					

						require_once("dbcontroller.php");

						$db_handle = new DBController();

						$sql = "SELECT regno,name,Subjects,code,weeklytest,ex,(code+weeklytest+ex) as total from $claff WHERE subjects='$subjj' ";

						$faq = $db_handle->runQuery($sql);

						

			

						

						echo "

						<div id='ajaxDiv'><H3>".$subj." ".$subj.'</H3></div>

						<table align="center" class="table table-striped table-bordered">

								  <thead>

									  <tr>

									<th class="table-header">NAME</th>

										<th class="table-header">SUBJECT</th>

										<th class="table-header" width="10%">CA1</th>

										<th class="table-header" width="10%">CA2</th>

										<th class="table-header" width="10%">EXAM</th>

							

										<th class="table-header" width="10%">TOTAL</th>

									  </tr>

								  </thead>

								  <tbody>';

								 

								  foreach($faq as $k=>$v) {

								 echo '

									  <tr class="table-row">

									<td>'.$faq[$k]["name"].'</td>

										<td>'.$faq[$k]["Subjects"].'</td>

										<td align="center" contenteditable="true" onBlur=';

										echo '"saveToDatabase(this,'."'".$ass."','".$faq[$k]["regno"]."'".');"  onClick="showEdit(this);">'.$faq[$k][$ass].'</td> 

										

										<td align="center" contenteditable="true" onBlur=';

										echo '"saveToDatabase(this,'."'".$ass2."','".$faq[$k]["regno"]."'".');"  onClick="showEdit(this);">'.$faq[$k][$ass2].'</td> 

										<td align="center" contenteditable="true" onBlur=';

										echo '"saveToDatabase(this,'."'".$ass3."','".$faq[$k]["regno"]."'".');"  onClick="showEdit(this);">'.$faq[$k][$ass3].'</td> 

									 

										<td>'.$faq[$k]["total"].'</td>

										</tr>';

								}

						 }

								?>

								  </tbody>

								</table>   

				</div>

			</div>

		

		<div class="panel-footer"><center><font color="#fff"> &copy; LionGate Soft. </font></center>

</div>

		</div>

		

	</div>



	      

	

<!-- edit modal -->

	

 <script src="js/fusioncharts.js"></script>

<script src="js/jquery-3.1.1.js"></script>

<script src="js/jquery.js"></script>

<script src="js/jquery.easing.1.3.js"></script>

<script src="js/bootstrap.min.js"></script>

<script src="js/jquery.fancybox.pack.js"></script>

<script src="js/jquery.fancybox-media.js"></script>  

<script src="js/jquery.flexslider.js"></script>

<script src="js/animate.js"></script>

<!-- Vendor Scripts -->

<script src="js/modernizr.custom.js"></script>

<script src="js/jquery.isotope.min.js"></script>

<script src="js/jquery.magnific-popup.min.js"></script>

<script src="js/animate.js"></script>

<script src="js/custom.js"></script> 



</body>

</html>