I have a form that generates an SQL statement, based on the users choices. It is functioning much like the report wizard in MS Access. On the last step, I have all the data, and the dynamically generated SQL query, but I need a way where they can download it as a file. How should I go about this?
Currently I have three buttons called 'View Results' (which just shows HTML generated results, that is easy - they just open up in a new tab)
'Download CSV' (preferably I would like this when clicked to just act like a normal download of a file, the user gets prompted to save as etc by the browser)
'Download PDF' (same as CSV)
At the moment when the CSV button is pressed a new tab opens up with export_report.php, which outputs CSV style report data.
How can I achieve the desired results with the CSV and PDF button? I have all the data and information I need to generate either but I am unsure how to proceed forward with this.