This appearantly isn't proper, and needs to be send to a spot on our server, without prompt.
Code: Select all
<? $select = "SELECT * FROM surveys WHERE Mem_ID =".$ID;
$export = mysql_query($select);
$fields = mysql_num_fields($export);
for ($i = 0; $i < $fields; $i++) {
$header .= mysql_field_name($export, $i) . "\t";
while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
}
$data = str_replace("\r","",$data);
if ($data == "") {
$data = "\n(0) Records Found!\n";
}
$xlsdate = date('Y-m-d');
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=$xlsdate$ID.xls");
header("Content-Disposition: attachment; filename=$xlsdate$ID.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
?>What would you do to select a location to automatically download this file, prompt free... on the sly if you will.
Code: Select all
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=$xlsdate$ID.xls");
header("Content-Disposition: attachment; filename=$xlsdate$ID.xls");