Hello, I have written a custom plugin which will display some data from a particular table. Main Admin View of this plugin http://content.screencast.com/users/esigners/folders/wp/media/4d4a41f8-6f0f-487f-bd8d-2f28f42b3260/csv1.jpg When I click on the 'Export to CSV' button the following window is opened http://content.screencast.com/users/esigners/folders/wp/media/7428479d-1ec2-4f63-b334-634f17a95052/csv2.jpg rather not giving me any option to download the converted CSV file. I need that when I click on the 'Export to CSV' button it give me the csv file to download my computer. Here is the code section in the plugin for converting mysql data to CSV. // Get all the data from wp_newslette table $newsletter_result = mysql_query ("SELECT * FROM wp_newsletter WHERE newsletter = 1 ORDER BY nl_id DESC") or die (mysql_error()); // Export all the data to CSV if ($_POST['submit']) { $out = ''; $fields = @mysql_list_fields('iwords','wp_newsletter'); $columns = @mysql_num_fields($fields); // Put the name of all the fields for ($i = 0; $i < $columns; $i++) { $l=mysql_field_name($fields, $i); $out .= '"'.$l.'",'; } $out .="\n"; // Add all the values in the table while ($l = mysql_fetch_array($newsletter_result)) { for ($i = 0; $i < $columns; $i++) { $out .='"'.$l["$i"].'",'; } $out .="\n"; } @header("Content-type: text/x-csv"); @header("Content-Disposition: attachment; filename=filename.csv"); echo $out; exit; } PHP:
i will customized this plugin for you.what exact you need but it will cost you near about $100 for that if you interested post me or add me dj_developer ( at ) skype. ?
Try putting quotes around the filename: @header("Content-Disposition: attachment; filename=\"filename.csv\""); Code (markup): Or use a filename variable: $filename = "filename.csv"; @header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\";"); Code (markup):