I suggest po to set an error flag and error msg in your controller po when an error occured.
Here is the snippet

in controller
```php
if ($password != $repassword) {
    $is_error = true;
    $error_message = "Password did not match";
}
```

and in view file
```php
<?php if ($is_error) : ?> 
    <div class="alert alert-block alert-error">
        <h4 class="alert-heading">Registration error!</h4>
        <div><?php echo $error_msg ?></div>
    </div>
<?php endif ?>
```