I do something similar Lorna, except my $messages is an array of arrays, keyed by the field in question. You can also get rid of the $can_proceed by testing if the messages array is empty.

[geshi lang=php]
$errMessages = array();
$name = isset($_POST['name']) ? $_POST['name'] : null;

$errMessages['name'][] = 'Required field';

if($name != 'Richard'){
$errMessages['name'][] = 'Your name is not Richard';

// handle errors
// continue

It's useful to retain the field=>error information so that you can display the error message next to the input field in the UI, or provide more context for the consumer of a web-service.

(I will normally json_encode that array and inject the json into my html page in the view, and then use Javascript to enhance the html input fields based on that data.)