Problem After loading CSV, once the form does not send a request when it is submitted.
Purpose . To load a CSV file of information after selecting several criteria to download.
PHP scripts :
export.php displays an HTML form that allows the user to select certain criteria (basically setting a couple of variables, and then sending these criteria to load the CSV file.
exportEntrants.php uses these variables defined by the form to retrieve the corresponding data from the database, create CSV data and then provide it to the user as a download to the user.
So, in export.phpwe have the following fragment:
require_once 'exportEntrants.php';
if(){
export($criteria);
}
else{
}
Which successfully calls exportEntrants.php script when the form is submitted for the first time.
exportEntrants.php :
function download($content,$title) {
header('Content-Description: File Transfer');
header("Content-type: application/csv");
header('Content-Disposition: attachment; filename="'.$title.'.csv";');
echo $content;
exit();
}
, CSV . , "" if, , , .
, . - , , .
- , ? .
.
.
Javascript .
Firefox 7.0.1 Chrome 14. IE Safari.
HTML ( , , , HTML ( ):
<form action="/admin/export/export.php" method="post" name="exportForm" onsubmit="return formSubmit()"><input type="submit" name="submit_butt" value="EXPORT" class="button"></form>