I have in the past gathered errors into an array as the page is loading, then at the bottom of the page when the page is finished loading, if there are errors, the php script will write a jQuery script to the div container similar to this:
<div id="errors"></div>
<?php //if something goes wrong write error
$_error['type'][] = 'error1'; ?>
<html stuff>
<?php // something else goes wrong
$_error['type'][] = 'error2'; ?>
<more html>
<?php if(isset($_error)) { ?>
<script>
$('#errors').fadeIn('fast');
// This part you could loop if you had lots of types or come up with some
// elaborate javascript to populate your div
$('#errors').html('<?php echo implode("; ",$_error['type']); ?>');
</script>
<?php } ?>
6
solved Is it possible to make PHP print errors to a specific div? [closed]