I have developed a reporting page using php which will display the number of records from a table to the browser. This works fine, however i would like to provide user an option where 1. they can view the report in an excel sheet which can be opened or saved with a dialog box and 2. i would like the field names to be added in the first row of the excel sheet exactly how it happens while exporting a table from Myphp admin interface. Please provide the code for this. Any help will be greatly appreciated.