merhaba arkadaşlar,
bir noktada takıldım bir sipariş panelim var onaylanan siparişlerin çıktısını excel olarak alıyorum. daha sonra bu exceli kargoya mail atıyordum. yapmak isteiğim şu excel indir butonuna bastığımda excel in bir kopyasınıda sunucuda bir klasöre atmasını istiyorum. destek ve yardımcı olan arkadaşlara şimdiden teşekkürler.
<?php
include("baglanti.php");
include("class.phpmailer.php");
date_default_timezone_set('Europe/Istanbul');


$filelocation = 'file/';
$filename = 'siparisler-'.date('d-m-y').'-'.date('H.i.s').'.xls';
$file_export = $filelocation . $filename;

header('Content-Encoding: UTF-8');
header('Content-Type: text/plain; charset=utf-8');
header("Content-disposition: attachment; filename=".$filename."");


?>
<table border="2">
<tr>
<td>Tarih</td>
<td>Adı Soyadı</td>
<td>Telefon</td>
<td>Adres</td>
<td>İl</td>
<td>İlçe</td>
<td>Ürün</td>
<td>Ödeme Tipi</td>
</tr>
<?php
$sql=$dbconn->query("SELECT * from siparisler where durum1='2' order by sip_no");

while($oku=$sql->fetch(PDO::FETCH_ASSOC))
{
$tarih = $oku['tarih'];
$isim = $oku['ad_soyad'];
$telefon = $oku['tel'];
$adres = $oku['adres'];
$sehir = $oku['alan1'];
$ilce = $oku['alan3'];
$urun = $oku['urun'];
$notunuz = $oku['alan3'];

echo
"<tr>
<td>$tarih</td>
<td>$isim</td>
<td>$telefon</td>
<td>$adres</td>
<td>$sehir</td>
<td>$ilce</td>
<td>$urun</td>
<td>$notunuz</td>
</tr>";

}


?>
</table>