0

An Ajax function is not working ??

selectBatch1 is not replacing combobox

1.

<?php
	session_start();
	
	if($_REQUEST['action']=='')
		$_REQUEST['action']="sp";
	
	if(empty($_SESSION['uid']) && empty($_SESSION['username']))
	{			
	 	$url="index.php";
	    header('Location:'.$url);
	}
	else
	{
		if(isset($_COOKIE["PHPSESSID"]))
		{
		$uid=$_SESSION['uid'];
		$username=$_SESSION['username'];
		}
	 }

	//DB Connection
		$con=mysql_connect('localhost', 'tak27310_admin','admin123');
		if (!$con) { die('Could not connect: ' . mysql_error()); }
		mysql_select_db("tak27310_followup", $con);	
	
	//Pagination
		$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
		$perPage = isset($_GET['perPage']) ? $_GET['perPage'] : 10;
		$max_links = 10;
	
		function pagination_link($id, $page)
		  {
			  $nextpagetext = "";
			  $nextpagetext = '?page='.$page;
			  if(isset($_REQUEST['action']) && $_REQUEST['action']=="cr")
			  	$nextpagetext .= '&action='.$_REQUEST['action']."&date=".$_REQUEST['date']."&from=".$_REQUEST['from']."&course=".$_REQUEST['course']."&batch=".$_REQUEST['batch'] ;
			 
			  if(isset($_REQUEST['action']) && $_REQUEST['action']=="bd")
			  	$nextpagetext .= '&action='.$_REQUEST['action']."&feeStatus=".$_REQUEST['feeStatus']."&course=".$_REQUEST['course']."&batch=".$_REQUEST['batch'] ;
			  return $nextpagetext;
		  }
		  
	  	function pagination($count, $perPage, $id, $page, $max_links)
	  		{
			  $total_pages = ceil($count/$perPage);
			  if($page) 
			  {
			  if($page >10)
			  { 
			  $prev10 = '&nbsp;<a style = "color: #0000CC" href="'.pagination_link($id, ($page-10)).'" ><strong>Previous 10</strong></a>&nbsp;'; 
			  }
			  if($page >1)
			  { 
			  $prev = '&nbsp;<a style = "color: #0000CC" href="'.pagination_link($id, ($page-1)).'" ><strong>Previous</strong></a>&nbsp;'; 
			  $first = '<a href="'.pagination_link($id, 1).'">&lt;&lt;</a>'; 
			  }
	  		}
			  
			  if($page<$total_pages)
			  { 
			  	if($total_pages-$page>=10)
				  $next10 = '&nbsp;<a style = "color: #0000CC" href="'.pagination_link($id, ($page+10)).'"><strong>Next 10</strong></a>&nbsp; '; 
				else
				  $next10 = '&nbsp;<a style = "color: #0000CC" href="'.pagination_link($id, ($page+$total_pages-$page)).'"><strong>Next 10</strong></a>&nbsp; '; 
				  
				  $next = '&nbsp; <a style = "color: #0000CC" href="'.pagination_link($id, ($page+1)).'"><strong>Next</strong></a>&nbsp; '; 
				  $last = '<a href="'.pagination_link($id, $total_pages).'">&gt;&gt;</a>&nbsp; ';
			  }
			  echo $first;
			  echo $prev10;								  
			  echo $prev;
			  $loop = 0;
			  if($page >= $max_links) 
			  {
			 	 $page_counter = ceil($page - ($max_links-1));
			  } 
			  else
			  {
			  	$page_counter = 1;
			  }
			  
			  if($total_pages < $max_links)
			  {
			  	$max_links = $total_pages;
			  }
			  do 
			  { 
				  if($page_counter == $page) 
				  {
					  echo ' &nbsp; <strong style="color: #CC0033">'.$page_counter.'</strong> &nbsp; '; 
				  } 
				  else 
				  {
					  echo '<a style = "color: #000000" href="'.pagination_link($id, ($page_counter)).'">'.$page_counter.'</a> &nbsp; ';
				  } 
				  $page_counter++; $current_page=($page_counter+1);
				  $loop++;
			  } while ($max_links > $loop);
			  echo $next;
				  echo $next10;
			  echo $last;
			  }
	
	//for course dropdownbox
		if(isset($_REQUEST['course']))
			$ccourse = $_REQUEST['course'];
		else
			$ccourse = "All";
		
		$course_to_preselect = $ccourse;
		
		$resultCourse="SELECT * FROM courses WHERE status='Active' ORDER By name";
		$queryCourse=mysql_query($resultCourse);
		
		$options_courses = array();
			
		$options_courses[All] = 'All';
			
			while($rowCourse = mysql_fetch_array($queryCourse))
			{
		     	$options_courses[$rowCourse[id]] = $rowCourse[name];
		    }
		    
	//for batch dropdownbox
		if(isset($_REQUEST['batch']))
			$cbatch = $_REQUEST['batch'];
		else
			$cbatch = "All";
		
		$batch_to_preselect = $cbatch;
		
		$resultBatch="SELECT * FROM batch ORDER By batch";
		$queryBatch=mysql_query($resultBatch);
		
		$options_batches = array();
			
		$options_batches[All] = 'All';
			
			while($rowBatch = mysql_fetch_array($queryBatch))
			{
		     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
		    }
		    
	//For selected fee status
		if($_REQUEST['feeStatus']=='true')
		{
			$wf="CHECKED";
			$wof="UNCHECKED";
		}
		else if($_REQUEST['feeStatus']=='false')
		{
			$wof="CHECKED";
			$wf="UNCHECKED";
		}
		else
		{
			$wf="CHECKED";
			$wof="UNCHECKED";
		}

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Follow Up :: Search Prospect</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<script src="selectBatch.js" type="text/javascript"></script>
<script src="selectCustomer.js" type="text/javascript"></script>
<script src="php_calendar/scripts.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="datedialog-files/anchor-position.js"></script>
<script type="text/javascript" language="javascript" src="datedialog-files/datedialog.js"></script>

<link href="style.css" rel="stylesheet" type="text/css">
<link href="datedialog-files/datedialog.css" rel="stylesheet" type="text/css" >

<script type="text/javascript">
	function disablebatch()
	{
		if(document.myform.inactive_check.checked)
			{
			document.myform.inactive_check.value=1;
			document.myform.inactive_batch.disabled=true;
			document.myform.batch.disabled=true;
			}
		else
			{
			document.myform.inactive_check.value=0;
			document.myform.inactive_batch.disabled=false;			
			document.myform.batch.disabled=false;
			}
	}
	function openWin(fromdate, uid){
	  var d = window.open("misRecords.php?fromdate=" + fromdate + "&uid=" + uid, "details" , "location=0, menubar=0, scrollbars=1, status=0, titlebar=0, toolbar=0, directories=0, resizable=1, width=600, height=350, top=50, left=50");
	  d.resizeTo(600, 350);
	  d.moveTo(250, 50);
	}

</script>

<style type="text/css">
	#searchPanel select, input{
		font-size:9pt;
	}
	select{
		width:150px;
		font-size:10pt;
	}
	misrpt a{
		color:white;
		text-decoration:none;
	}
	tbody.scrollContent{
		height:250px;
		overflow:auto;
		width:100%;
}
</style>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" onload="selectBatch1(document.getElementById('course').value)">
<form action="<?php echo $_SERVER['PHP_SELF']."?action=".$_REQUEST['action'];?>" method="post" name="myform" id="myform">

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  	<tr style="background-image:url('images/tops.png'); height:160px;">
    	<td style=" vertical-align:bottom;" class="td-format white-text">
		     <div style="float:right; padding-right:20px; text-align:center ">
		     <b>Welcome to TOPS</b><br><br><?php echo $username; ?></div>
		</td>
	</tr>
	<tr>
	    <td>
	    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		      <tr>
		      	<td style="width: 162px"><a href="prospects.php?page=1"><img src="images/prospect-dark.png" alt="" border="0"></a></td>
	
		      	<td><a href="followup.php"><img src="images/index_03.gif" alt="" border="0"></a></td>
				<td><a href="students.php"><img src="images/students-dark.png" alt="" border="0"></a></td>
				<td><a href="mis.php"><img src="images/MIS-white.png" alt="" border="0"></a></td>
				
				<?php if($_SESSION['usertype']=="Administrator") { ?>
				
		        <td><a href="admin.php" style="text-decoration:none; border-color:transparent"><img src="images/admin-dark.png" alt="" border="0px" style="text-decoration:none"></a></td>
		        <?php } ?>
	
		        <td style="width:550px; height:40px; background-image:url('images/index_07.gif'); text-align:left; padding-left:10px; font-weight:bold;" class="td-format white-text"></td>
	
		        <td style="background-image:url('images/index_07.gif'); width:613px; text-align:right; padding-right:20px;" class="td-format white-text"><a href="" class="white-text">
					<a class="white-text" href="change-password-content.php">
				Change Password</a> | <a href="logout.php" class="white-text">
				Logout</a>
				</td>
		      </tr>
	    	</table>
	    </td>
	</tr>
</table>

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="white">
	<tr>
		<td colspan="2" style="padding:10px 10px 0 10px" align="center">
			<table width="100%" cellpadding="0" cellspacing="0" style="border:1px #5F6A89 solid;">
				<tr>
					<td class="td-format">
						<table id="searchPanel" class="td-format" cellpadding="6px" cellspacing="0" style="width:100%">
						<?php if($_REQUEST['action'] == "cr") { ?>
							<tr>
								<td style="text-align:right; text-align:right;">
								Select Course</td>
								<td>
									<div style=" float:left;">
									<input type="checkbox" value="<?php if(isset($_POST['inactive_check'])) echo $_POST['inactive_check']; ?>" onclick="disablebatch(); selectinactivecourse(this.checked);" id="inactive_check" name="inactive_check" <?php if(isset($_POST['inactive_check'])) echo "checked";?>></div><div style=" float:left; padding-top:2px; padding-left:5px;"> 
										Inactive</div>
								</td>
								<td style="text-align:left">
									<div id="inactivecourse">
									<?php
									if($_POST['inactive_check'])
									{
										if(isset($_REQUEST['course']))
											$ccourse = $_REQUEST['course'];
										else
											$ccourse = "All";
	
										$resultCourse="SELECT * FROM courses WHERE status='Inactive' ORDER By name";
										$queryCourse=mysql_query($resultCourse);
										
										$options_courses = array();
											
										$options_courses[All] = 'All';
											
										while($rowCourse = mysql_fetch_array($queryCourse))
										{
									     	$options_courses[$rowCourse[id]] = $rowCourse[name];
									    }
    									?>
    									<select id="course" name="course" style="width:145px" onchange="selectBatch1(this.value, document.myform.inactive_check.value);">
    									<option>Top</option>
    									<?php
										foreach ($options_courses as $index => $value)
										{
										    echo '    <option value="' . $index . '"';
										    if ($index == $course_to_preselect)
										    {
										        echo ' selected ';
										    }
										    echo '>' . $value . '</option>';
										}
										?></select><?php

									}
									else
									{
									?>
									<select id="course" name="course" style="width:145px" onchange="selectBatch1(this.value, document.myform.inactive_check.value);">
										<?php
										foreach ($options_courses as $index => $value)
										{
										    echo '    <option value="' . $index . '"';
										    if ($index == $course_to_preselect)
										    {
										        echo ' selected ';
										    }
										    echo '>' . $value . '</option>';
										}
										?>
									</select>
									<?php
									}
									?>
									</div>
								</td>
								<td>
								</td>
								<td style="text-align:right">
								</td>
								<td>
								</td>
								<td style="text-align:right">
									
								</td>
								<td>
								</td>
								<td style="padding-right:15px; text-align:right">
									
								</td>
							</tr>
							<tr>
								<td style="text-align:right;" id="td_selectbatch">
								Select Batch</td>
								<td>
								<div style=" float:left;">
								<?php if($_POST['inactive_check']) { ?>
								<input type="checkbox" onclick="selectinactivebatch(this.checked);" disabled="disabled" id="inactive_batch" name="inactive_batch" <?php if(isset($_POST['inactive_batch'])) echo "checked";?>>
								<?php } else { ?>
								<input type="checkbox" onclick="selectinactivebatch(this.checked);" id="inactive_batch" name="inactive_batch" <?php if(isset($_POST['inactive_batch'])) echo "checked";?>>
								<?php } ?>
								</div><div style=" float:left; padding-top:2px; padding-left:5px;"> 
									Inactive</div>
								</td>
								<td>								
								<?php //for batch dropdownbox
									if(isset($_REQUEST['batch']))
										$cbatch = $_REQUEST['batch'];
									else
										$cbatch = "All";
									
									$batch_to_preselect = $cbatch;
									
									$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";

									$queryBatch=mysql_query($resultBatch);
									
									$options_batches = array();
										
									$options_batches[All] = 'All';
										
										while($rowBatch = mysql_fetch_array($queryBatch))
										{
									     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
									    }
								?>
								<div id="txtBatch">
									
									<select id="batch" name="batch" style="width:145px">
										<?php
										foreach ($options_batches as $index => $value)
										{
										    echo '    <option value="' . $index . '"';
										    if ($index == $batch_to_preselect)
										    {
										        echo ' selected ';
										    }
										    echo '>' . $value . '</option>';
										}
										?>
									</select>
								
								</div>
								</td>
								<td></td>
								<td><label style="padding-left:5px;">From: </label>	</td>
								<td><input type="text" name="date" id="date" style="width:100px" value="<?php if(isset($_REQUEST['date'])){echo $_REQUEST['date'];}?>" >
											&nbsp;&nbsp;<img src="php_calendar/cal.gif" onclick="javascript:viewcalendar()" alt="From" title="Select From Date" style="cursor:pointer;"></td>
								<td><label style="padding-left:5px;">To: </label></td>
								<td><input type="text" name="from" id="from" style="width:100px" value="<?php if(isset($_REQUEST['from'])){echo $_REQUEST['from'];}?>" >
											&nbsp;&nbsp;<img src="php_calendar/cal.gif" onclick="javascript:viewcalendar1()" alt="To"  title="Select To Date" style="cursor:pointer;"></td>
								<td><input type="submit" name="search" value="Go"></td>
							</tr>
						<?php } else if($_REQUEST['action'] == "bd") { ?>
							<tr>
								<td style="text-align:right">
									<label style="padding-right:25px; padding-left:5px;">
									Select Course: </label>	
								</td>
								<td style="text-align:left;">
								<div style=" float:left;">
									<input type="checkbox" id="inactive_check" name="inactive_check" value="<?php if(isset($_POST['inactive_check'])) echo $_POST['inactive_check']; ?>" onclick="disablebatch(); cr_selectinactivecourse(this.checked); " id="inactive_check" name="inactive_check" <?php if(isset($_POST['inactive_check'])) echo "checked";?>></div><div style=" float:left; padding-top:2px; padding-left:5px;"> 
									Inactive</div>
								</td>
								<td style="text-align:left;">
								<select id="course" name="course" onchange="selectBatch1(this.value, document.myform.inactive_check.value);">
										<?php
										foreach ($options_courses as $index => $value)
										{
										    echo '    <option value="' . $index . '"';
										    if ($index == $course_to_preselect)
										    {
										        echo ' selected ';
										    }
										    echo '>' . $value . '</option>';
										}
										?>
								</select>
								</td>
								<td>
								
								</td>
								<td>
								</td>
								<td style="padding-right:15px; text-align:right">
									
								</td>
								<td></td>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td style="text-align:right;"><label style="padding-right:25px; padding-left:5px;">
								Select Batch: </label></td>
								<td>
								<div style=" float:left;">
								<?php if($_POST['inactive_check']) { ?>
								<input type="checkbox" onclick="selectinactivebatch(this.checked);" disabled="disabled" id="inactive_batch" name="inactive_batch" <?php if(isset($_POST['inactive_batch'])) echo "checked";?>>
								<?php } else { ?>
								<input type="checkbox" onclick="selectinactivebatch(this.checked);" id="inactive_batch" name="inactive_batch" <?php if(isset($_POST['inactive_batch'])) echo "checked";?>>
								<?php } ?>
								</div><div style=" float:left; padding-top:2px; padding-left:5px;"> 
									Inactive</div>
								<td>
								<div id="txtBatch">
									<select id="batch" name="batch">
										<?php
										foreach ($options_batches as $index => $value)
										{
										    echo '    <option value="' . $index . '"';
										    if ($index == $batch_to_preselect)
										    {
										        echo ' selected ';
										    }
										    echo '>' . $value . '</option>';
										}
										?>
									</select>
								</div>
								</td>
								<td></td>
								<td>
									<input type="radio" name="feeStatus" value="true" <?php echo $wf; ?>>&nbsp;With 
									Fee&nbsp;
									<input type="radio" name="feeStatus" value="false" <?php echo $wof; ?>>&nbsp;Without 
									Fee
								</td>
								<td><input type="submit" name="search" value="Go"></td>
								<td></td>
								<td></td>
							</tr>
						<?php } ?>
						</table>
					</td>
				</tr>
			</table>	
		</td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td style="background-color:white; width:20%; padding:0 0 50px 10px" valign="top">
			<table border="0" cellspacing="0" cellpadding="0" style="width: 100%; vertical-align:top; border:1px #5F6A89 solid;  height:100px;"  align="center">
		  		<tr style="height:22px; background-image:url('images/bar.gif'); color:white; padding:5px 0 0 10px" class="td-format">
		  			<td style="padding-left:10px;">MIS Panel</td>
		  		</tr>
		  		<tr> 	
			      	<td style="padding-left:10px; height: 27px;"><a href="mis.php?action=sp">
					Search Reports</a></td>	  			
		  		</tr>
		  		<tr> 	
			      	<td style="padding-left:10px; height: 27px;"><a href="mis.php?action=lof&username=All">
					Open Follow-ups</a></td>	  			
		  		</tr>
		  		<tr>
		  			<td style="padding-left:10px; height: 27px;"><a href="mis.php?action=lpnf&orderby=name">
					Prospects without Follow-ups</a></td>
		  		</tr>
		  		<tr>
		  			<td style="padding-left:10px; height: 27px;"><a href="mis-student.php?action=cr" <?php if($_REQUEST['action']=='cr') echo "style=color:#fb651f"; ?>>
					Collection Report</a></td>
		  		</tr>
		  		<tr>
		  			<td style="padding-left:10px; height: 27px;"><a href="mis-student.php?action=bd" <?php if($_REQUEST['action']=='bd') echo "style=color:#fb651f"; ?>>
					Batch Details</a></td>
		  		</tr>
		  	</table>
   		</td>
   		
		<td align="left" bgcolor="#FFFFFF" style=" padding:0 10 20 10; vertical-align:top;">
			<div id="txtHint">
			
						
		<!--Search Result Starts here-->
			<table id="misrpt" cellpadding="0" cellspacing="0" width="100%" style="border:1px #5F6A89 solid">
							
				<?php
					if(isset($_POST['search']) && $_REQUEST['action'] == "cr")
					{
						$fromdate = date('Y-m-d', strtotime($_REQUEST['date']));
						$todate = date('Y-m-d', strtotime($_REQUEST['from']));		
				?>
				
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px;">
					<td colspan="7" style="height:30px; padding:0 0 0 5px; vertical-align :middle; font-size:10pt; border-bottom:1px white solid">
						Collection Report for <strong>Course:</strong>
						
						<?php
							if($_REQUEST['course'] == 'All')
							{
								echo "All";
							}
							else
							{
								$result = mysql_query("select * from courses where id = ".$_REQUEST['course']);
								$row = mysql_fetch_array($result);
							}
							
							echo $row['name'];
						?>
						
						and <strong>Batch:</strong>
						
						<?php
							if($_REQUEST['course']=='All' && $_REQUEST['inactive_check']==1)
								echo "All Inactive Courses";
							else if($_REQUEST['batch'] == 'All')
								echo "All";
							else
							{
								if($_REQUEST['course']=='All' && $_REQUEST['inactive_check']==1)
									echo "All Inactive Batch";
								else
								{
								$result = mysql_query("select * from batch where bid = ".$_REQUEST['batch']);
								$row = mysql_fetch_array($result);
								}
							}
							
							echo $row['batch'];
						?>

					</td>
				</tr>
				
				<?php
					if($_REQUEST['date']!='' && $_REQUEST['from']!='')
					{
					$fromdate = date('Y-m-d', strtotime($_REQUEST['date']));
					$todate = date('Y-m-d', strtotime($_REQUEST['from']));	

					if($_REQUEST['course']!='All' && $_REQUEST['batch']=='All')
						$countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.cid = ".$_REQUEST['course']." AND r.amount != '0.00'");
					else if($_REQUEST['course']=='All' && $_REQUEST['batch']!='All')
						$countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00'");
					else if($_REQUEST['course']!='All' && $_REQUEST['batch']!='All')
						$countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.cid = ".$_REQUEST['course']." AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00'");
					else					
						$countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND r.amount != '0.00'");
 					}
					else
					{
					if($_REQUEST['course']=='All' && $_REQUEST['inactive_check']==1)
						{ 
							 $res=mysql_query("select * from batch where batch_status='Inactive'");
		 					 while($row2=mysql_fetch_array($res))
								 $b.="s.bid = ".$row2[bid]." or ";
							 $len=strlen($b);
							 $b=substr($b, 0, $len-3);

							 $countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.amount != '0.00' and ($b)");
						}
					else if($_REQUEST['course']!='All' && $_REQUEST['batch']=='All')
						{ 
						$countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.cid = ".$_REQUEST['course']." AND r.amount != '0.00'"); 
						}
					else if($_REQUEST['course']=='All' && $_REQUEST['batch']!='All')
						{ $countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00'"); }
					else if($_REQUEST['course']!='All' && $_REQUEST['batch']!='All')
						{ $countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.cid = ".$_REQUEST['course']." AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00'"); }
					else					
						{ $countQCR = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.amount != '0.00'"); }
 					}
 					$count = current(mysql_fetch_array($countQCR));
				?>
														
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px; height:25px">
					<td class="td-format" style="padding:5px"><strong>Name</strong></td>				
					<td class="td-format" style="padding:5px"><strong>Mobile</strong></td>
					<td class="td-format" style="padding:5px"><strong>Receipt 
					No.</strong></td>
					<td class="td-format" style="padding:5px"><strong>Date</strong></td>
					<td class="td-format" style="padding-right:35px; text-align:right"><strong>
					Amount</strong></td>
					<td class="td-format" style="padding:5px"><strong>Course</strong></td>
					<td class="td-format" style="padding:5px"><strong>Batch</strong></td>
				</tr>
						<tbody class="scrollContent">
					<?php
						if($count > 0)
	 						{
								if($_REQUEST['date']!='' && $_REQUEST['from']!='')
								{
								if($_REQUEST['course']!='All' && $_REQUEST['batch']=='All')
		 							$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.cid = ".$_REQUEST['course']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
		 						else if($_REQUEST['course']=='All' && $_REQUEST['batch']!='All')
									$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
								else if($_REQUEST['course']!='All' && $_REQUEST['batch']!='All')
									$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND s.cid = ".$_REQUEST['course']." AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
								else
			 						$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.date >= '$fromdate' AND r.date <= '$todate' AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
							}
							else
							{
								if($_REQUEST['course']=='All' && $_REQUEST['inactive_check']==1)
								{
	 								 $resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.amount != '0.00' and ($b) ORDER BY r.date DESC";
								}
								else if($_REQUEST['course']!='All' && $_REQUEST['batch']=='All')
		 							$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.cid = ".$_REQUEST['course']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
		 						else if($_REQUEST['course']=='All' && $_REQUEST['batch']!='All')
									$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
								else if($_REQUEST['course']!='All' && $_REQUEST['batch']!='All')
									$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND s.cid = ".$_REQUEST['course']." AND s.bid = ".$_REQUEST['batch']." AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
								else
			 						$resultCR = "SELECT p.name as name, p.mobile as mobile, r.receipt_no as receipt_no, r.date as date, r.amount as amount, c.name as course, b.batch as batch  FROM students as s, prospects as p, receipt as r, courses as c, batch as b WHERE s.pid = p.pid AND s.sid = r.sid AND c.id = s.cid AND b.bid = s.bid AND r.amount != '0.00' ORDER BY r.date DESC"; //LIMIT ".$offset.", ".$perPage;
							}
	 						$queryCR=mysql_query($resultCR);
							$total = 0;							
		
		 						while($rowCR = mysql_fetch_array($queryCR))
		 						{
		 						$total += $rowCR[amount];
	 				?>
			 				
				 			<tr>
				 				<td class="td-format" style="padding:4px"><?php echo $rowCR[name]; ?></td>
				 				<td class="td-format" style="padding:4px"><?php echo $rowCR[mobile]; ?></td>
				 				<td class="td-format" style="padding:4px; text-align:center"><?php echo $rowCR[receipt_no]; ?></td>
								<td class="td-format" style="padding:4px"><?php echo date('d-M-Y', strtotime($rowCR['date'])); ?></td>
				 				<td class="td-format" style="padding-right:30px; text-align:right"><?php echo $rowCR[amount]; ?></td>
				 				<td class="td-format" style="padding:4px"><?php echo $rowCR[course]; ?></td>
				 				<td class="td-format" style="padding:4px"><?php echo $rowCR[batch]; ?></td>
				 			</tr>
			 			<?php
				 				}
				 				
				 		?>
				 		</tbody>
				 			<tr>
				 				<td colspan="3" class="td-format" style="padding:5px; border-top:1px #5F6A89 solid">
								&nbsp;</td>
				 				<td class="td-format" style="padding:7px; border-top:1px #5F6A89 solid"><strong>
								Total:</strong></td>
				 				<td class="td-format" style="padding-right:30px; text-align:right; border-top:1px #5F6A89 solid"><strong><?php echo number_format($total, 2, '.', ''); ?></strong></td>
				 				<td colspan="2" class="td-format" style="padding:5px; border-top:1px #5F6A89 solid">
								&nbsp;</td>
				 			</tr>
				 		<?php
				 		?>	
				 				<tr>
									<td colspan="7" style="text-align:center; border-top:1px #5F6A89 solid;padding:5px">
										<div class="td-format" align="right" style=" padding:0 0 0 0; margin:0 0 0 0; font-size:8pt">
											Results <b><?php echo "1"; ?></b> 
									    	- <b><?php echo $count; ?></b> 
											Out of <b><?php echo $count;?></b></div>
									</td>
							    </tr>
				<?php
				 			}
				 			else
				 				echo "<tr><td colspan=\"6\" class=\"td-format\" style=\"padding:10px; text-align:center; color:blue; font-weight:bold; vertical-align:top\">No Records Found!</td></tr>";		
				 	}
				 	else if($_REQUEST['action'] == "bd" && $_REQUEST['feeStatus'] == 'true')
				 	{
				?>
				
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px;">
					<td colspan="6" style="height:30px; padding:0 0 0 5px; vertical-align :middle; font-size:10pt; border-bottom:1px white solid">
						Batch Details for <strong>Course:</strong>
						
						<?php
							if($_REQUEST['course'] == 'All')
							{
								echo "All";
							}
							else
							{
								$result = mysql_query("select * from courses where id = ".$_REQUEST['course']);
								$row = mysql_fetch_array($result);
							}
							
							echo $row['name'];
						?>
						
						and <strong>Batch:</strong>
						
						<?php
							if($_REQUEST['batch'] == 'All')
							{
								echo "All";
							}
							else
							{
								$result = mysql_query("select * from batch where bid = ".$_REQUEST['batch']);
								$row = mysql_fetch_array($result);
							}
							
							echo $row['batch'];
						?>

					</td>
				</tr>
				
				<?php
					$cid = $_REQUEST['course'];
					$bid = $_REQUEST['batch'];
					
					if($cid == "All" && $bid != "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.bid = $bid AND s.status=true");
					else if($cid != "All" && $bid == "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.status=true");
					else if($cid != "All" && $bid != "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.bid = $bid AND s.status=true");
					else
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.status=true");
						
 					$count = current(mysql_fetch_array($countQBD));
				?>
														
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px; height:25px">
					<td class="td-format" style="padding:5px"><strong>S.no.</strong></td>				
					<td class="td-format" style="padding:5px"><strong>Name</strong></td>				
					<td class="td-format" style="padding:5px"><strong>Mobile</strong></td>
					<td class="td-format" style="padding:5px"><strong>Email</strong></td>
					<td class="td-format" style="padding:5px; text-align:center"><strong>
					Outstanding Fees</strong></td>
				</tr>
					<tbody class="scrollContent">
					
					<?php
						//$offset = ($page-1) * $perPage;
						
						if($count > 0)
	 						{
	 							if($cid == "All" && $bid != "All")
			 						$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.bid = $bid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
		 						else if($cid != "All" && $bid == "All")
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
								else if($cid != "All" && $bid != "All")
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.bid = $bid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
								else
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
						
	 							$queryBD=mysql_query($resultBD);
								
								$sno += 1;	
		 						while($rowBD = mysql_fetch_array($queryBD))
		 						{
		 							$outTotal += $rowBD[fee_due];
	 				?>
			 				
				 			<tr>
								<td class="td-format" style="padding:5px"><?php echo $sno; ?></td>
				 				<td class="td-format" style="padding:5px"><?php echo $rowBD[name]; ?></td>
				 				<td class="td-format" style="padding:5px"><?php echo $rowBD[mobile]; ?></td>
				 				<td class="td-format" style="padding:5px"><?php echo $rowBD[email]; ?></td>
				 				<td class="td-format" style="padding:5px; text-align:right; padding-right:30px"><?php echo $rowBD[fee_due]; ?></td>
				 			</tr>
				 			
			 			<?php
							$sno++;
				 				}
				 			//$pageCount = ceil($count/ $perPage);
				 		?>	
					</tbody>
								<tr>
					 				<td colspan="3" class="td-format" style="padding:5px; border-top:1px #5F6A89 solid">
									&nbsp;</td>
					 				<td class="td-format" style="padding:7px; border-top:1px #5F6A89 solid; text-align:right"><strong>
									Total:</strong></td>
					 				<td class="td-format" style="padding-right:30px; text-align:right; border-top:1px #5F6A89 solid"><strong><?php echo number_format($outTotal, 2, '.', ''); ?></strong></td>
					 				<td colspan="2" class="td-format" style="padding:5px; border-top:1px #5F6A89 solid">
									&nbsp;</td>
					 			</tr>

				 				<tr>
									<!--<td colspan="6" style="text-align:center; border-top:1px #5F6A89 solid;padding:5px">
										<?php if($count>$max_links) { pagination($count, $perPage, $id, $page, $max_links); } ?>
										<div class="td-format" align="right" style=" padding:0 0 0 0; margin:0 0 0 0; font-size:8pt">
											Results <b><?php echo ($page-1)*$perPage+1;?></b> 
									    	- <b><?php echo min(array($page*$perPage,$count));?></b> 
											Out of <b><?php echo $count;?></b><br><br><a href="<?php echo "bdwf_reports/index.php?cid=".$_REQUEST['course']."&bid=".$_REQUEST['batch']; ?>" target="_blank" style="font-size:9pt">Print Report</a></div>
									</td>-->
									<td colspan="7" style="text-align:center; border-top:1px #5F6A89 solid;padding:5px">
										<div class="td-format" align="right" style=" padding:0 0 0 0; margin:0 0 0 0; font-size:8pt">
											Results <b><?php echo "1"; ?></b> 
									    	- <b><?php echo $count; ?></b> 
											Out of <b><?php echo $count;?></b><br><br><a href="<?php echo "bdwf_reports/index.php?cid=".$_REQUEST['course']."&bid=".$_REQUEST['batch']; ?>" target="_blank" style="font-size:9pt">
											Print Report</a></div>
									</td>
							    </tr>
				<?php
				 			}
				 			else
				 				echo "<tr><td colspan=\"6\" class=\"td-format\" style=\"padding:10px; text-align:center; color:blue; font-weight:bold; vertical-align:top\">No Records Found!</td></tr>";		
				 	}
				 	else if($_REQUEST['action'] == "bd" && $_REQUEST['feeStatus'] == 'false')
				 	{
				?>
			
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px;">
					<td colspan="8" style="height:30px; padding:0 0 0 5px; vertical-align :middle; font-size:10pt; border-bottom:1px white solid">
						Batch Details for <strong>Course:</strong>
						
						<?php
							if($_REQUEST['course'] == 'All')
							{
								echo "All";
							}
							else
							{
								$result = mysql_query("select * from courses where id = ".$_REQUEST['course']);
								$row = mysql_fetch_array($result);
							}
							
							echo $row['name'];
						?>
						
						and <strong>Batch:</strong>
						
						<?php
							if($_REQUEST['batch'] == 'All')
							{
								echo "All";
							}
							else
							{
								$result = mysql_query("select * from batch where bid = ".$_REQUEST['batch']);
								$row = mysql_fetch_array($result);
							}
							
							echo $row['batch'];
						?>
 
					</td>
				</tr>
				
				<?php
					$cid = $_REQUEST['course'];
					$bid = $_REQUEST['batch'];
					
					if($cid == "All" && $bid != "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.bid = $bid AND s.status=true");
					else if($cid != "All" && $bid == "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.status=true");
					else if($cid != "All" && $bid != "All")
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.bid = $bid AND s.status=true");
					else
						$countQBD = mysql_query("SELECT COUNT(*) as count FROM students as s, prospects as p WHERE s.pid = p.pid AND s.status=true");
						
 					$count = current(mysql_fetch_array($countQBD));
				?>
														
				<tr class="td-format white-text" style="background-color:#575B66; padding-top:2px; height:25px">
					<td class="td-format" style="padding:5px"><strong>S.no.</strong></td>				
					<td class="td-format" style="padding:5px"><strong>Name</strong></td>				
					<td class="td-format" style="padding:5px"><strong>Mobile</strong></td>
					<td class="td-format" style="padding:5px"><strong>Email</strong></td>
					<td class="td-format" style="padding:5px"><strong>Date1</strong></td>
					<td class="td-format" style="padding:5px"><strong>Date2</strong></td>
					<td class="td-format" style="padding:5px"><strong>Date3</strong></td>
					<td class="td-format" style="padding:5px"><strong>Date4</strong></td>
				</tr>
					<tbody class="scrollContent">

					<?php
						//$offset = ($page-1) * $perPage;
						
						if($count > 0)
	 						{
	 							if($cid == "All" && $bid != "All")
			 						$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.bid = $bid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
		 						else if($cid != "All" && $bid == "All")
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
								else if($cid != "All" && $bid != "All")
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.cid = $cid AND s.bid = $bid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
								else
									$resultBD = "SELECT * FROM students as s, prospects as p WHERE s.pid = p.pid AND s.status=true ORDER BY p.name"; //LIMIT ".$offset.", ".$perPage;
						
	 							$queryBD=mysql_query($resultBD);

								$sno += 1;	
		 						while($rowBD = mysql_fetch_array($queryBD))
		 						{
	 							if($rowBD[fee_due]>'0.00')
				 					echo "<tr style=color:red>";
				 				else
				 					echo "<tr>";
				 	?>
						 				<td class="td-format" style="padding:5px"><?php echo $sno; ?></td>
										<td class="td-format" style="padding:5px"><?php echo $rowBD[name]; ?></td>
						 				<td class="td-format" style="padding:5px"><?php echo $rowBD[mobile]; ?></td>
						 				<td class="td-format" style="padding:5px"><?php echo $rowBD[email]; ?></td>
						 				<td class="td-format" style="padding:5px">
										&nbsp;</td>
						 				<td class="td-format" style="padding:5px">
										&nbsp;</td>
						 				<td class="td-format" style="padding:5px">
										&nbsp;</td>
						 				<td class="td-format" style="padding:5px">
										&nbsp;</td>
						 			</tr>
				 			
			 			<?php
							$sno++;
				 				}
				 			//$pageCount = ceil($count/ $perPage);
				 		?>
					</tbody>	
				 				<tr>
									<!--<td colspan="7" style="text-align:center; border-top:1px #5F6A89 solid;padding:5px">
										<?php if($count>$max_links) { pagination($count, $perPage, $id, $page, $max_links); } ?>
										<div class="td-format" align="right" style=" padding:0 0 0 0; margin:0 0 0 0; font-size:8pt">
											Results <b><?php echo ($page-1)*$perPage+1;?></b> 
									    	- <b><?php echo min(array($page*$perPage,$count));?></b> 
											Out of <b><?php echo $count;?></b><br><br><a href="<?php echo "bd_reports/index.php?cid=".$_REQUEST['course']."&bid=".$_REQUEST['batch']; ?>" target="_blank" style="font-size:9pt">Print Report</a></div>
									</td>-->
									<td colspan="8" style="text-align:center; border-top:1px #5F6A89 solid;padding:5px">
										<div class="td-format" align="right" style=" padding:0 0 0 0; margin:0 0 0 0; font-size:8pt">
											Results <b><?php echo "1"; ?></b> 
									    	- <b><?php echo $count; ?></b> 
											Out of <b><?php echo $count;?></b><br><br><a href="<?php echo "bd_reports/index.php?cid=".$_REQUEST['course']."&bid=".$_REQUEST['batch']; ?>" target="_blank" style="font-size:9pt">
											Print Report</a></div>
									</td>
							    </tr>
				<?php
				 			}
				 			else
				 				echo "<tr><td colspan=\"6\" class=\"td-format\" style=\"padding:10px; text-align:center; color:blue; font-weight:bold; vertical-align:top\">No Records Found!</td></tr>";		
				 	}
				?>

			</table>
			</div>
		</td>
	</tr>
</table>  

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	    <td height="80" align="center" background="images/index_45.gif" class="white-text td-format">
			Powered by <a href="http://kaconsultancy.com/" target="_blank" class="orange-text-underline">
			KA Consultancy Services</a>
		</td>
	</tr>
</table>

</form>
</body>
</html>

2.

var xmlhttp
var xmlhttp1
var xmlhttp3
var xmlhttpcheck
var xmlhttpcheck2
var xmlhttpbatch
var xmlhttpbatch3
var xmlhttpcheck_inactivebatch

		function showBatch(str)
		{
		//alert (str);
		xmlhttp=GetXmlHttpObject();
		if (xmlhttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  }
		var url="selectBatch.php";
		url=url+"?b="+str;
		xmlhttp.onreadystatechange=stateChanged;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
		}
		
		function GetXmlHttpObject()
		{
		if (window.XMLHttpRequest)
		  {
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  return new XMLHttpRequest();
		  }
		if (window.ActiveXObject)
		  {
		  // code for IE6, IE5
		  return new ActiveXObject("Microsoft.XMLHTTP");
		  }
		return null;
		}
	
		function stateChanged()
		{
		if (xmlhttp.readyState==4)
		  {
		  document.getElementById("txtHint").innerHTML=xmlhttp.responseText;  
		  }
		}

/////////////////////////////////////////////////////////////

function cr_selectinactivecourse(checkboxvalue)
{
var check;
if(checkboxvalue==true)
	check=1;
else
	check=0;
xmlhttpcheck=GetXmlHttpObjectcheck(this.value);
if (xmlhttpcheck==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="selectBatch.php";
url=url+"?action=inactive_course_collection";
url=url+"&val="+check;

xmlhttpcheck.onreadystatechange=stateChangedcheck;
xmlhttpcheck.open("GET",url,true);
xmlhttpcheck.send(null);
}

function GetXmlHttpObjectcheck()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function stateChangedcheck()
{
if (xmlhttpcheck.readyState==4)
  {
  document.getElementById("inactivecourse").innerHTML=xmlhttpcheck.responseText;  
  }
}
		

/////////////////////////////////////////////////////////////////////////////////////////////
		function selectbatch3(checkboxvalue)
		{
		var check2;
		if(checkboxvalue)
		check2=1;
		else
		check2=0;
		xmlhttpbatch3=GetXmlHttpObjectbatch3(this.value);
		if (xmlhttpbatch3==null)
		{
		alert ("Your browser does not support AJAX!");
		return;
		}
		var url2="selectBatch.php";
		url2=url2+"?action=inactive_course_check";
		url2=url2+"&val="+check2;
		xmlhttpbatch3.onreadystatechange=stateChangedbatch3;
		xmlhttpbatch3.open("GET",url,true);
		xmlhttpbatch3.send(null);
		}
		
		function GetXmlHttpObjectbatch3()
		{
		if (window.XMLHttpRequest)
		{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
		}
		if (window.ActiveXObject)
		{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
		}
		return null;
		}
		
		function stateChangedbatch3()
		{
		if (xmlhttpbatch3.readyState==4)
		{
		document.getElementById("txtBatch").innerHTML=xmlhttpbatch3.responseText;  
		}
		}
/////////////////////////////////////////////////////////////////////////////////////////////

function selectinactivebatch(checkboxvalue)
{
var check;
if(checkboxvalue)
	check=1;
else
	check=0;
xmlhttpbatch=GetXmlHttpObjectbatch(this.value);
if (xmlhttpbatch==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="selectBatch.php";
url=url+"?action=inactive_batch_collection";
url=url+"&val="+check;
xmlhttpbatch.onreadystatechange=stateChangedbatch;
xmlhttpbatch.open("GET",url,true);
xmlhttpbatch.send(null);
}

function GetXmlHttpObjectbatch()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function stateChangedbatch()
{
if (xmlhttpbatch.readyState==4)
  {
  document.getElementById("txtBatch").innerHTML=xmlhttpbatch.responseText;  
  }
}

//////////////////////////////////////////////////////////////////////////////////////////

		function selectBatch1(str, str1)
		{
		var v=str1;
		xmlhttp1=GetXmlHttpObject1();
		if (xmlhttp1==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  }
		var url="selectBatch.php";
		url=url+"?c="+str;
		url=url+"&action=misrpt";
		if(v==0)
			url=url+"&val=0";
		if(v==1)
			url=url+"&val=1";

		alert(url);
		xmlhttp1.onreadystatechange=stateChanged1;
		xmlhttp1.open("GET",url,true);
		xmlhttp1.send(null);
		}
		
		function GetXmlHttpObject1()
		{
		if (window.XMLHttpRequest)
		  {
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  return new XMLHttpRequest();
		  }
		if (window.ActiveXObject)
		  {
		  // code for IE6, IE5
		  return new ActiveXObject("Microsoft.XMLHTTP");
		  }
		return null;
		}
		
		function stateChanged1()
		{
		if (xmlhttp1.readyState==4)
		  {
		  document.getElementById("txtBatch").innerHTML=xmlhttp1.responseText;  
		  }
		} 

/////////////////////////////////////////////////////////////////////////////
function allbatches(str)
{

var v=str1;
xmlhttp3=GetXmlHttpObject35();
if (xmlhttp3==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="selectBatch.php";
url=url+"?c="+str;
url=url+"&action=allbatches";
if(v==0)
	url=url+"&val=0";
if(v==1)
	url=url+"&val=1";
	
//alert(url);	
xmlhttp3.onreadystatechange=stateChanged35;
xmlhttp3.open("GET",url,true);
xmlhttp3.send(null);
}

function GetXmlHttpObject35()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function stateChanged35()
{
if (xmlhttp3.readyState==4)
  {
  document.getElementById("txtBatch").innerHTML=xmlhttp.responseText;  
  }
}

///////////////////////////////////////////////////////////////////////////////////////////////

		function selectinactivecourse(checkboxvalue)
		{
		var check;
		if(checkboxvalue==true)
			check=1;
		else
			check=0;
		xmlhttpcheck2=GetXmlHttpObjectcheck2(this.value);
		if (xmlhttpcheck2==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  }
		var url="selectBatch.php";
		url=url+"?action=inactive_course_collection";
		url=url+"&val="+check;
		
		xmlhttpcheck2.onreadystatechange=stateChangedcheck2;
		xmlhttpcheck2.open("GET",url,true);
		xmlhttpcheck2.send(null);
		}
		
		function GetXmlHttpObjectcheck2()
		{
		if (window.XMLHttpRequest)
		  {
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  return new XMLHttpRequest();
		  }
		if (window.ActiveXObject)
		  {
		  // code for IE6, IE5
		  return new ActiveXObject("Microsoft.XMLHTTP");
		  }
		return null;
		}
		
		function stateChangedcheck2()
		{
		if (xmlhttpcheck2.readyState==4)
		  {
		  document.getElementById("inactivecourse").innerHTML=xmlhttpcheck2.responseText;  
		  }
		}

3.

<?php
session_start();
if(empty($_SESSION['uid']) && empty($_SESSION['username']))
{			
 	$url="index.php";
    header('Location:'.$url);
 }
else
 {
   	 
	 if(isset($_COOKIE["PHPSESSID"]))
	  {
	    $uid=$_SESSION['uid'];
	    $username=$_SESSION['username'];	
	  }
  }
?>
<html>
<head>
<script src="selectBatch.js" type="text/javascript"></script>
</head>
<body></body>
</html>
<?php
$con = mysql_connect('localhost', 'tak27310_admin','admin123');
mysql_select_db('tak27310_followup', $con);

if($_REQUEST['action'] == 'prospectsinactive')
{
	if(!empty($_REQUEST['q']))
		$ccourse = $_REQUEST['q'];
	else if(!empty($_REQUEST['coursename']))
		$ccourse = $_REQUEST['coursename'];
	else
		$ccourse = "All";
	
	if($_REQUEST['val']==1)
	{	$resultCourse="SELECT * FROM courses WHERE status='Inactive' ORDER By name";  }
	if($_REQUEST['val']==0)
	{	$resultCourse="SELECT * FROM courses ORDER By name"; }

	$course_to_preselect = $ccourse;
	$queryCourse=mysql_query($resultCourse);
	$options_courses = array();
	$options_courses[All] = 'All';
	
	while($rowCourse = mysql_fetch_array($queryCourse))
	{
     	$options_courses[$rowCourse[id]] = $rowCourse[name];
    }
	?>
	<select name="coursename" style="width:145px" onchange="showCourse(this.value)">
	<?php
	foreach ($options_courses as $index => $value)
	{
	    echo '    <option value="' . $index . '" ';
	    if ($index == $course_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php	
}
else if($_REQUEST['action'] == 'allbatches')
{
	if($_REQUEST['val']==1)
	{	$resultCourse="SELECT * FROM courses WHERE status='Inactive' ORDER By name";  }
	if($_REQUEST['val']==0)
	{	$resultCourse="SELECT * FROM courses ORDER By name"; }
	
	$course_to_preselect = $ccourse;
	$queryCourse=mysql_query($resultCourse);
	$options_courses = array();
	$options_courses[All] = 'All';
	
	while($rowCourse = mysql_fetch_array($queryCourse))
	{
     	$options_courses[$rowCourse[id]] = $rowCourse[name];
    }
	?>
	<select id="course" name="course" style="width:145px" onchange="selectBatch1(this.value, document.myform.inactive_check.value);">
	<?php
	foreach ($options_courses as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $course_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php	
}
else if($_REQUEST['action'] == 'inactive_batch_collection')
{
	 	//for batch dropdownbox
		if(isset($_REQUEST['b']))
			$cbatch = $_REQUEST['b'];
		else
			$cbatch = 'All';			
		
		$batch_to_preselect = $cbatch;
		
		if($_REQUEST['val'] == 1)
			$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive' ORDER By batch";
		else
			$resultBatch="SELECT * FROM batch ORDER By batch";
			
		$queryBatch=mysql_query($resultBatch);
		$options_batches = array();
		$options_batches[All] = 'All';
			
			while($rowBatch = mysql_fetch_array($queryBatch))
			{
		     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
		    }
?>

	<select id="batch" name="batch" style="width:125px">
		<?php
		foreach ($options_batches as $index => $value)
		{
		    echo '    <option value="' . $index . '"';
		    if ($index == $batch_to_preselect)
		    {
		        echo ' selected ';
		    }
		    echo '>' . $value . '</option>';
		}
		?>
	</select>
<?php
}
else if($_REQUEST['action'] == 'inactive_course_collection')
{
	if($_REQUEST['val']==1)
	{	$resultCourse="SELECT * FROM courses WHERE status='Inactive' ORDER By name";  }
	if($_REQUEST['val']==0)
	{	$resultCourse="SELECT * FROM courses ORDER By name"; }
	
	$course_to_preselect = $ccourse;
	$queryCourse=mysql_query($resultCourse);
	$options_courses = array();
	$options_courses[All] = 'All';
	
	while($rowCourse = mysql_fetch_array($queryCourse))
	{
     	$options_courses[$rowCourse[id]] = $rowCourse[name];
    }
	?>
	<select id="course" name="course" style="width:145px" onchange="selectBatch1(this.value, document.myform.inactive_check.value);">
	<?php
	foreach ($options_courses as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $course_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php	
}
else if($_REQUEST['action'] == 'inactive')
{
	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
					
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive' ORDER By batch";
	else
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive' AND cid = ".$_REQUEST['c']." ORDER By batch";
		
	$queryBatch=mysql_query($resultBatch);
	$options_batches = array();
	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>

	<select id="batch" name="batch" style="width:125px" onchange="showCourseBatch2(document.getElementById('course').value, this.value, document.getElementById('orderby').value, document.getElementById('sortby').value)">
	<option value="All">All</option>
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php
}
else if($_REQUEST['action'] == 'as')
{
	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
					
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";
	else
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' AND cid = ".$_REQUEST['c']." ORDER By batch";
		
	$queryBatch=mysql_query($resultBatch);
	$options_batches = array();
	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>
	<select id="batch" name="batch" style="width:125px">
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php
}
else if($_REQUEST['action'] == 'edit')
{
	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
					
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";
	else
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' AND cid = ".$_REQUEST['c']." ORDER By batch";
		
	$queryBatch=mysql_query($resultBatch);
	
	$options_batches = array();

	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>

	<select id="batch" name="batch" style="width:125px">
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php
}
else if($_REQUEST['action']=='misrpt')
{
	echo $_REQUEST['action'];
	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
	else
		$cbatch = 'All';			
	
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All' && $_REQUEST['val']==1)
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive'";
	else if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";
	else
		{
		if($_REQUEST['val']==0) // Checked
			$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' AND cid = ".$_REQUEST['c']." ORDER By batch";
		if($_REQUEST['val']==1)	// Unchecked
			$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive' AND cid = ".$_REQUEST['c']." ORDER By batch";
		}
		
	if($_REQUEST['val2']==1)			
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Inactive'";
			
	echo $resultBatch;
	$queryBatch=mysql_query($resultBatch);
	$options_batches = array();
	$options_batches[All] = 'All';
		
	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>
	<select id="batch" name="batch" style="width:125px">
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php
}
else if($_REQUEST['action'] == 'r')
{
echo "2";
}
else if($_REQUEST['action'] == 'rcpt')
{

	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
	else
		$cbatch = 'All';			
		
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";
	else
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' AND cid = ".$_REQUEST['c']." ORDER By batch";
		
	$queryBatch=mysql_query($resultBatch);
	
	$options_batches = array();
	
	$options_batches[All] = 'All';
			
	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>
	<select id="batch" name="batch" style="width:125px" onchange="showCourseBatch(document.getElementById('course').value, this.value, document.getElementById('orderby').value, document.getElementById('sortby').value)">
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
<?php
}
else
{
	//for batch dropdownbox
	if(isset($_REQUEST['b']))
		$cbatch = $_REQUEST['b'];
	else
		$cbatch = 'All';			
		
	$batch_to_preselect = $cbatch;
	
	if($_REQUEST['c'] == 'All')
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' ORDER By batch";
	else
		$resultBatch="SELECT * FROM batch WHERE batch_status = 'Active' AND cid = ".$_REQUEST['c']." ORDER By batch";
		
	$queryBatch=mysql_query($resultBatch);
	
	$options_batches = array();
	
	$options_batches[All] = 'All';
		
	while($rowBatch = mysql_fetch_array($queryBatch))
	{
     	$options_batches[$rowBatch[bid]] = $rowBatch[batch];
    }
	?>

	<select id="batch" name="batch" style="width:125px" onchange="showCourseBatch(document.getElementById('course').value, this.value)">
	<?php
	foreach ($options_batches as $index => $value)
	{
	    echo '    <option value="' . $index . '"';
	    if ($index == $batch_to_preselect)
	    {
	        echo ' selected ';
	    }
	    echo '>' . $value . '</option>';
	}
	?>
	</select>
	<?php
	}
?>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by diafol
0

Ok so what do you want?

Almost 2000 lines of code. Ha ha ha ha. Good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.