I'm writing code to deal with errors, and part of this is printing a message to the user (eg "Whoops!")
However, the error code does not know what has gone before, so there is a danger that the error message might be hidden.
For example, what if the error occurs when generating Javascript? Then the HTML output would look like this:
....
<script>
var x = Whoops!
Then as far as the user sees, there is no error message and the page just stops.
The usual solution is to print a barrage of closing tags before you print your error message:
'">--></script></table>Whoops!
The user may see extra stuff appear on the page like ">-->" which isn't neat, but they will see the error message, which is the important thing.
So my question is, what other closing tags can you think of to place in the above string to ensure the user can always see the error message?
EDIT: Yes, I'm aware this isn't the best way and that output buffering can be a better technique. Sorry, should have had in the original question that I can't use use output buffering for this.