controller not displaying a message in phalcon php

I’m trying to make a simple example in Phalcon PHP framework, so i have a view which contain two fields name and email and a submit button. When i click in this button a function of a controller is called to store the name and the email in the DB. This action goes well the problem is I’m trying to display a message after the action ends but i still have the view that contain the form (name, email). Here's my code.

My checkout controller. > class CheckoutController extends \Phalcon\Mvc\Controller {

public function indexAction()
{


}

public function registerAction()
{
    $email = new Emails();

    //Stocker l'email et vérifier les erreurs
    $success = $email->save($this->request->getPost(), array('name', 'email'));

    if ($success) {
        echo "Thanks for shopping with us!";
    } else {
        echo "Sorry:";
        foreach ($user->getMessages() as $message) {
            echo $message->getMessage(), "<br/>";
        }
    }

}

}

Flash works much better than echoing although echo should work but in the view file (checkout/register.phtml) you also need to add $this->getContent(); (for phtml)

In the $di

//Set up the flash service

$di->set('flash', function() { return new \Phalcon\Flash\Direct(); });

Then in the controller

public function registerAction()
{
   $email = new Emails();

  //Stocker l'email et vérifier les erreurs
  $success = $email->save($this->request->getPost(), array('name', 'email'));

  if ($success) {
      $this->flash->success("Thanks for shopping with us!");
  } else {
      echo "Sorry:";
      foreach ($user->getMessages() as $message) {
          $this->flash->error($message->getMessage(), "<br/>");
      }
  }

}