One way (and there are of course always at least 100 ways to do something with a good language) is to assign your message into a variable.
Then, perhaps using an if condition, print your message in whatever format you'd like (in a table, bold, etc) in your html.
A good example would perhaps be:
// some sort of authentication failed
$message = "I'm sorry, that username and password combination is incorrect."
echo "<head><title>Titles titles titles!</title></head><body>";
if ($message) {
echo "<center><h3><em>$message</em></h3></center>";
}
// echo the rest of your html page and whatever you want to do
The idea being simply, rather than immediately printing the error message, just save the message for printing in the space you want it to be printed.