PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've got a download page which redirects to files based on the input in a form.
Redirect uses the header function but I also wish to fwrite to a log file from this same page. Will the fwrite function be carried out even after redirect has occurred?
I was trying it for ages and I couldn't get it to work so I thought I'd post in here to see if it was a lost cause but I've got it working now anyway so i guess the answer is "Yes", code after the header will be executed but not before the header.
It will also work when they there is output (echo or print).
But this will make the header function fail (because headers have to be outputted before anything else gets outputted). In case you are using output buffering, you could work around that "problem"