You can store the errors in sessions if you don't post the data to the same page.
PHP Code:
session_start();
if (/* username exists */)
{
$_SESSION['errors'][] = 'Username taken';
}
// Go back to previous page and...
if (is_array($_SESSION['errors']))
{
echo 'Following errors ocurred: <br />';
foreach ($_SESSION['errors'] AS $error)
{
echo '- '. $error .'<br />'. "\n";
}
}