ok
Direktori : /home/ngwcolle/www/mis/admin/ |
Current File : /home/ngwcolle/www/mis/admin/exportstudent.php |
<?php include('includes/checklogin.php'); $output = ''; if(isset($_POST["export"])) { $year=$_POST['hdnyear']; $course=$_POST['hdncourse']; $schname=$_POST['hdnschname']; $cnt = 1; $sql="SELECT tblstudents.*,tbl_subject.subject from tblstudents inner join tbl_subject on tblstudents.subid=tbl_subject.id where tblstudents.coursename='$course' and tblstudents.year='$year'"; // echo $sql; // echo '<h6 class="text-danger pl-3"> You are submitting details for the year' . $schyear . " in " . $course . " course of " . $schname . ' scheme.</h6>'; $smt = $dbh->prepare($sql); $smt->execute(); $data = $smt->fetchAll(PDO::FETCH_OBJ); $output .= '<table border="1"> <tbody> <tr style="background-color: #D6EEEE;"> <th>Sl. No.</th> <th>Year</th> <th>Course Name</th> <th>Subject</th> <th>No.of Students Admitted</th> <th>CLC Taken</th> </tr>'; foreach ($data as $row) { $output .= '<tr> <td>'.$cnt.'</td> <td>'.$row->year.'</td> <td>'.$row->coursename.'</td> <td>'.$row->subject.'</td> <td>'.$row->admitted.'</td> <td>'.$row->clc.'</td> </tr>'; $cnt = $cnt + 1; } $output .= '</tbody></table>'; header('Content-Type: application/xls'); header('Content-Disposition: attachment; filename=studentreport.xls'); echo $output; } ?>