<?php
session_start();

include 'koneksi/koneksi.php';
$app = mysql_fetch_array(mysql_query("SELECT * from aplikasi where id_user='$_SESSION[id]'"));

$skr = date('Y-m-d');
header("Content-type: application/vnd-ms-excel");
 
// Mendefinisikan nama file ekspor "hasil-export.xls"
header("Content-Disposition: attachment; filename=saran-export.xls");
 ?>
									<table  border="1"  align="center">
                                        <thead>
                                            <tr>
                                                <td align="center">#</td>
                                                <td align="center">Tanggal</td>
                                                <td align="center">Jawaban</td>
                                                <td align="center">Saran</td>
												
                                            </tr>
                                        </thead>
                                        <tbody>
											<?php 
											$id_pertanyaan = mysql_fetch_assoc(mysql_query("SELECT * from pertanyaan where id_user = '$_SESSION[id]' AND status='1' order by id desc"));
											$s_survey = mysql_query("SELECT * from survey where tanggal between '$_GET[start]' AND '$_GET[end]' AND id_pertanyaan='$id_pertanyaan[id]' AND saran !='' ");
											$i=1;
											while ($d_survey = mysql_fetch_array($s_survey)){
											?>
                                            <tr>
                                                <td align="center"><?= $i++;?></td>
                                                <td align="center"><?= $d_survey['tanggal'];?></td>
                                                <td align="center"><?php if($d_survey['survey']=='SP'){echo 'Sangat Puas';} else if($d_survey['survey']=='P') {echo 'Puas';} else if($d_survey['survey']=='C') {echo 'Cukup'; } else if($d_survey['survey']=='TP') {echo 'Tidak Puas';}  ?></td>
												<td align="center"><?= $d_survey['saran'];?></td>
												
											</tr>
											<?php ;} ?>
											 
                                        </tbody>
                                    </table>
                               