ok
Direktori : /home/ngwcolle/public_html/mis/admin/ |
Current File : //home/ngwcolle/public_html/mis/admin/export.php |
<?php include('includes/checklogin.php'); $output = ''; if(isset($_POST["export"])) { $year=$_POST['hdnyear']; $course=$_POST['hdncourse']; $schname=$_POST['hdnschname']; $sql="SELECT * from tblschstudents where coursename='$course' and year='$year' and schname='$schname'"; // 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 rowspan="2">Year</th> <th rowspan="2">Scholarship Name</th> <th rowspan="2">Course</th> <th colspan="2">SC</th> <th colspan="2">ST</th> <th colspan="2">PWD</th> <th colspan="2">OBC</th> <th colspan="2">GEN</th> <th colspan="2">Minority</th> </tr> <tr style="background-color: #D6EEEE;"> <th>Boys</th> <th>Girls</th> <th>Boys</th> <th>Girls</th> <th>Boys</th> <th>Girls</th> <th>Boys</th> <th>Girls</th> <th>Boys</th> <th>Girls</th> <th>Boys</th> <th>Girls</th> </tr>'; foreach ($data as $row) { $output .= '<tr> <td>'.$row->year.'</td> <td>'.$row->schname.'</td> <td>'.$row->coursename.'</td> <td>'.$row->scb.'</td> <td>'.$row->scg.'</td> <td>'.$row->stb.'</td> <td>'.$row->stb.'</td> <td>'.$row->pwdb.'</td> <td>'.$row->pwdg.'</td> <td>'.$row->obcb.'</td> <td>'.$row->obcg.'</td> <td>'.$row->genb.'</td> <td>'.$row->geng.'</td> <td>'.$row->minb.'</td> <td>'.$row->ming.'</td> </tr>'; } $output .= '</tbody></table>'; header('Content-Type: application/xls'); header('Content-Disposition: attachment; filename=download.xls'); echo $output; } ?>