Does anyone know why this line prevents even scriptcase macros from running?

Hi,

I am working on a Master / Detail application and I have created a button to generate an excel file. I have used phpspreadsheet to achieve it since I have not managed phpexcel to work well.
Within all the developed code I include these lines to save the excel file.
$file = fopen (“filexlsx.php”, “a”);
fwrite ($file, $content);
fclose ($file);
header (“Location: filexlsx.php”);

The fact is that the last line does not allow the execution of macros like sc_error_message or instructions like echo and even an internal function to show messages.

Does anyone know why?

All help is grateful.

The header is directly relocating, and sc_error_message is an ajax instruction. All output is sent after the application ‘closes,’ but due to the header you never get to see anything. If you need messages, i.e., for debugging you should put that in the filexlsx.php or log them into a log file.

Thanks for your answer. It is totally clear. And thank you very much for the suggestion for debugging messages, this will be very useful for me.