How to show a ‘correct’ message after submit a form?

I solved the problem. First I check if there are errors and then I add a custom redirect url like this:

if ( count($error) == 0 ) {
     wp_redirect( get_permalink() . '?updated=true' );
}

And finally I added a message using ‘GET’ method:

<?php if ( $_GET['updated'] == 'true' ) : ?> <p class="form-submit-success" style="color: green">Your profile has been updated</p>