header("Content-Disposition: attachment; filename=yourfile.txt");
@binaryLV Because I imagine he wants people to see and read thanks.php. If you used a redirect, they would never see the page.
Why not? Open "thanks.php" page and send "refresh" header (not "redirect", as I wrote before). What's the problem?
You PHP code will serve up the thanks page, and after it is loaded, you will want to direct a hidden iFrame in your page to a page which serves up the file as a download, using the following headers: