Need to make input button ( name=checkbox[ ] ) that is under form that is exporting selected checkboxes from mysql table to csv. Input button and all other is made and at the moment is not important. Answer is somewhere where this code is saying that is taking all table no checked one.
<?php
include_once 'conection.php';
if (isset($_POST['export'])) {
header('Content-Type:text/csv; chaset=utf-8');
header('Content-Disposition:attachment; filename=data.csv');
$output = fopen("php://output", "w");
// fputscv need to show that selected checkbox is exported, but my knowladges ends here...
fputcsv($output, array('id', 'Email', 'DayTime'));
$query = "SELECT * FROM email ORDER BY id DESC";
$results = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($results)) {
fputcsv($output, $row);
}
fclose($output);
}
Aucun commentaire:
Enregistrer un commentaire