<?php  
session_start();
require_once '../../includes/conn.php'; 
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/table_data_center_with_border_black.css">
</head>
<body>

<div class="container" style="width:100%;">
 <br>
 <center>
<?php
				   $pq=mysqli_query($con,"select * from stuff left join `user` on user.userid=stuff.userid where stuff.userid='".$_SESSION['id']."'");
				   while($pqrow=mysqli_fetch_array($pq)){
				?>
			    <span style="font-size:21;font-weight:bold;">
			  <?php echo $pqrow['business_name']; ?><br>
				 </span> 
				   <?php }?>
  <span style="font-size:20;">        
Batch Wise Student List <br>
</span> 
<span style="font-size:19;"> 
			
			<?php
				   $BatchNo = $_POST['BatchNo'];
				   $pq=mysqli_query($con,"select * from batch where id= '$BatchNo' and user_id='".$_SESSION['id']."' ");
				   while($pqrow=mysqli_fetch_array($pq)){
				?>				 
			      Batch Name  :  <?php echo $pqrow['batch_name']; ?> 
				  
				   <?php }?>
				   
	
<br>
Print Date : <?php echo date("M d, Y") ;?> | 
Time   : <?php date_default_timezone_set("Asia/Dhaka"); echo  date("h:i:sa");?>  
		  </span> </center>  
<br>

<?php  
if($_POST) {
    
	$BatchNo = $_POST['BatchNo']; 
	
	$sql = "SELECT * FROM customer 
	left join product on product.product_id =customer.course_id
	where customer.batch_no='$BatchNo' and customer.member_id='".$_SESSION['id']."' 
	order by customer.customer_id asc ";
	
	$query = $con->query($sql);
    
	$sl=0;
	$table = '
	<table border="1" cellspacing="0" cellpadding="0" class="table table-bordered" style="width:100%;">
		
		<tr>          
                             <th>SL</th> 
                                <th>Name</th>
                                <th>Course Name</th>
								<th>Address</th>
								<th>Phone</th>
				            	<th>Admi.Date</th>  
								<th>Comments</th>
							
		</tr>

		<tr>';
		
		while ($result = $query->fetch_assoc()) {
			$table .= '<tr>
				 
				<td><center>'.++$sl.'</center></td> 
				<td><center>'.$result['customer_name'].'</center></td>
				<td><center>'.$result['product_name'].'</center></td>
				<td><center>'.$result['address'].'</center></td>
				<td><center>'.$result['contact_info'].'</center></td>
	     		<td><center>'.date("M d, Y", strtotime($result['join_date'])).'</center></td>  
			     <td></td>
			</tr>';	
			
			
		}
		$table .= '
		</tr>
	
		
	</table>
	';	

	echo $table;

}

?>
 
</body>
</html>
