header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename={$filename}.xls"); header("Pragma: no-cache"); header("Expires: 0"); /*******Start of Formatting for Excel*******/ //define separator (defines columns in excel & tabs in word) $sep = "\t"; //tabbed character $schema_insert = ""; echo 'S/N' . $sep; echo 'Application Number' . $sep; echo 'Fullname' . $sep; echo 'Programme' . $sep; echo 'Date of Application' . $sep; echo 'Admission Status' . $sep; print "\n"; $serialno = 1; while ($row = $database->fetch_array($result)) { $schema_insert .= $serialno . $sep; $schema_insert .= $row["form_id"] . $sep; $schema_insert .= ucwords($row["surname"]) . ' ' . $row["first_name"] . ' ' . $row["middle_name"] . $sep; $schema_insert .= $row["department_name"] . $sep; $schema_insert .= date('Y-m-d', $row["time_completed_application"]) . $sep; $schema_insert .= admission_status($row["status"]) . $sep; $schema_insert .= "\n"; $serialno++; } echo $schema_insert; } else { redirect_to('view_applicant.php'); }
<th>Admission Status</th> </tr> </thead>'; echo '<tbody>'; } echo ' <tr>'; if ($role == 1 || $role == 5) { echo '<td><input type="checkbox" name="applicant_id_' . $serialno . '" value="' . customEncrypt($result['applicant_id']) . '"> </td>'; } echo '<td>' . $serialno . '</td> <td>' . $result["form_id"] . '</td> <td>' . ucwords($result["surname"]) . ' ' . $result["first_name"] . ' ' . $result["middle_name"] . '</td> <td>' . $result["department_name"] . '</td> <td>' . date('Y-m-d', $result["time_completed_application"]) . '</td> <td>' . admission_status($result["status"]) . '</td> <td> <a href="applicant_details.php?' . md5('applicant_id') . '=' . customEncrypt($result['applicant_id']) . '" class="btn btn-primary">View</a> </td> </tr>'; if ($serialno % 10 == 0) { echo '</tbody>'; echo '</table>'; echo '</div>'; $pagecounter++; } elseif ($serialno == $number_of_applicants) { echo '</tbody>'; echo '</table>'; echo '</div>'; }