title: Zend flash messenger
body: <p>I have a form and the submit button check if true or false.</p>
  
  <p>If it's true redirect to another page.</p>
  
  <p>If it's false stay on the same page and print the error message.</p>
  
  <p>The error message is print out with a flash messenger.
  But, in some case it doesn't print in the first try when submit is false, it always print out on the second click.</p>
  
  <p>Did I did something wrong?
  And also, is there a way to set difference flash messenger name? Because, on my others pages that have flash messenger, print out the error when page is refreshed.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>if(isset($_POST['submit'])) {
      // code to inputfields
  
      if(true) {
          //redirect to some page
      } else {
          // print the flash error on the same page
          $this-&gt;_helper-&gt;flashMessenger-&gt;addMessage(" This email is already taken");
          $this-&gt;view-&gt;messages = $this-&gt;_helper-&gt;flashMessenger-&gt;getMessages();
      }
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;center&gt;
              &lt;div style="color:red"&gt;
              &lt;?php if (count($this-&gt;messages)) : ?&gt;
                  &lt;?php foreach ($this-&gt;messages as $message) : ?&gt;
                  &lt;div id="field_name"&gt;
                  &lt;strong style="text-transform:capitalize;"&gt;Email &lt;/strong&gt;
                      - &lt;?php echo $this-&gt;escape($message); ?&gt;
                  &lt;/div&gt;
                  &lt;?php endforeach; ?&gt;
              &lt;?php endif; ?&gt;
              &lt;/div&gt;
          &lt;/center&gt;
  </code></pre>