I was wondering if someone could give me some pointers on how to create a download popup as well as a location for the user to save it.
So when they click on my "Download as CSV" button, it'll give the user a prompt to select a destination in their directory.
Currently, I'm able to get a file downloaded working, but it's only if I run it from my command line. I'm not too sure how to implement headers with this.
The main issue is because I can't use fopen(), fwrite(), and fclose() because I'm adding only a single (albeit BIG) string to the csv file.
Here's some code that works only if I run the program locally.
$output = print_r(cleanUpEntry($info), true);
file_put_contents("output.csv", $output);
It downloads the file to the same exact folder as my PHP file, but I need it to work on a webpage so that the user can download the file.
Note* I can't use fputcsv since it only works for arrays, and mine is a multidimensional array, so it's much easier to just get the output of print_r.