I put together, from two other scripts, a script to email the input from a form and to write it to a mysql database at the same time.
The original email scripts had three or more little 'if' routines to catch errors, upon which there would be a jump to a new page and an exit. The jump via this header() function.
When I stuck the two together I started to get this 'can't modify header information...' error.
Reading up on it I found it is because the script has already made some output before the header() func, being 'print' statements on the success of the sql write.
I commented out the print statements and everything is fine.
But it raises the question for me about how to do this thing - jump to another page out of an 'if' ?
It seems to me to be quite reasonable to write a script that does all sorts of things and prints out a sort of 'progress report' as it is going and then, eventually, decides to leap to another page because of something it has encountered, good or bad.
But header() won't do this, it seems.
So what will?
Or has that methodology got to be abandoned?
Does this also mean that you can't use header() twice even when you use it correctly? That is: you use header() before any output, then make the output and therefore can't use header() again?
regards,
ab