here is my header..
$file_name = "contacts.csv";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file_name\"");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
after that i have echoed data like this....
echo '"First Name","Company","E-mail Address","E-mail 2 Address","E-mail 3 Address","Home Phone","Business Phone","Mobile Phone","Home Fax","Business Fax","Pager","Other Phone","Home City","Business City","Other City","Web Page","Title","Middle Name","Last Name","Job Title","Department","Birthday","Anniversary","Spouse"'."\n";
for($j=0; $j<count($data); $j++)
{
echo "\"".$data[$j]['name']."\",";
echo "\"".$data[$j]['company']."\",";
echo "\"".$data[$j]['email1Address']."\",";
echo "\"".$data[$j]['email2Address']."\",";
echo "\"".$data[$j]['email3Address']."\",";
echo "\"".$data[$j]['homePhone']."\",";
echo "\"".$data[$j]['businessPhone']."\",";
echo "\"".$data[$j]['mobilePhone']."\",";
echo "\"".$data[$j]['homeFax']."\",";
echo "\"".$data[$j]['businessFax']."\",";
echo "\"".$data[$j]['pager']."\",";
echo "\"".$data[$j]['otherPhone']."\",";
echo "\"".$data[$j]['homeAddress']."\",";
echo "\"".$data[$j]['businessAddress']."\",";
echo "\"".$data[$j]['otherAddress']."\",";
echo "\"".$data[$j]['webPage']."\",";
echo "\"".$data[$j]['title']."\",";
echo "\"".$data[$j]['middleName']."\",";
echo "\"".$data[$i]['lastName']."\",";
echo "\"".$data[$j]['jobTitle']."\",";
echo "\"".$data[$j]['department']."\",";
echo "\"".$data[$j]['birthDay']."\",";
echo "\"".$data[$j]['anniversary']."\",";
echo "\"".$data[$j]['spouse']."\"\n";
}
Yes but as I have said this code works if I run this seperately..