Current File : /home/inlingua/www/dwarka/icentex/student_ajaxOLD.php
<?php 
require('dbConnection.php');

// Include common functions
require('commonFunc.php');

// Include common functions
require('globalVars.php');

// Include the table handler class
require('dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$cid=$_REQUEST['CID'];
 
$sqlQ = "SELECT  recNo, language, level, startdate, enddate FROM ingl_course where courseid='".$cid."' ";
//echo $sqlQuery;
$res=mysql_query($sqlQ) or die();
$num=mysql_fetch_object($res);
if($num->level=='1A' || $num->level=='1B' || $num->level=='1B+') $table='level_1';
		else if($num->level=='2A' ||  $num->level=='2A+' || $num->level=='2B' || $num->level=='2B+' || $num->level=='E2-S2' || $num->level=='E2-S2+') $table='level_2';
		else if($num->level=='3A' || $num->level=='3B' || $num->level=='E3-S1' || $num->level=='E3-S2') $table='level_3';
		else if($num->level=='4') $table='level_4';
		else if($num->level=='5' ) $table='level_5';
		else if($num->level=='Private' ) $table='level_Private';
		
		$echovalue .="<table cellpadding='3'>";
$echovalue .="<tr><td><input type='hidden' name='language' value='".$num->language."' ><b>Language</b></td><td>".$num->language."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='level' value='".$num->level."' ><b>Level  </b></td><td>".$num->level."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='startDate' value='".$num->startdate."' ><b>Start date  </b></td><td>".$num->startdate."<br></td></tr>";	
$echovalue .="<tr><td><input type='hidden' name='endDate' value='".$num->enddate."' ><b>End date  </b></td><td>".$num->enddate."<br></td></tr></table>";	
		
 $sqlQuery = "SELECT  s.recNo, s.studentName,t.student_recNo  FROM ingl_student s 
left join ". $table." t on s.recNo=t.student_recNo left join ingl_course c on s.courseId=c.recNo
 where c.courseId='".$cid."' order by s.studentName desc ";
//echo $sqlQuery;

$result=mysql_query($sqlQuery) or die();
//$echovalue ="<select name='courseid'>";
$k=0;
$echovalue .="<table border='0' cellpadding='3' width='100%'>";
while($row=mysql_fetch_object($result))
{

if($row->student_recNo >0)
{}
else
{
 if($k%3==0 ) $echovalue .="<tr>";

$echovalue .="<td valign='top'><input name='student_id[]' type='checkbox' checked value='".$row->recNo."'>".$row->studentName."<br></td>";
if($k%3==2 ) $echovalue .="</tr>";
 $k++;
}

}

if($k>0)
{
$echovalue .="<tr><td colspan='3' align='right'>";
$echovalue .="<input type='submit' name='sub' class='submit1' id='sub' value=' Next >>' ><td></tr>";
}
else
{
$echovalue .="<tr><td colspan='3' align='right'>";
$echovalue .="<input type='submit' name='sub' class='submit2' id='sub' value=' Next >>' disabled ><br>(No Student Left)<td></tr>";
}

$echovalue .="</table>";

echo $echovalue;

?>