<?php
// display all messages
if (!empty($messages) && is_array($messages)):
    echo '<div id="messages">';
    foreach ($messages as $type => $msgs):
        foreach ($msgs as $message):
            if(!empty($message))
                echo ('<p class="' .  $type .'">' . $message . '</p>');
        endforeach;
    endforeach;
    echo '</div>';
endif;
?>
