title: Forms and success output
body: <p>Well,</p>
  
  <p>It's a beginner's question but I really don't know what is the best way.
  I have a basic <strong>CRUD</strong> (Create, Retrieve, Update and Delete) in my project and I'd like to output some message if succeeded or not in a <em>div</em> inside the same page.</p>
  
  <p>So, basically, I have a form which action is set to the same page and I have a <em>div #statusDiv</em> below this same form which I'd like to output something like <em>Register included with success</em>.</p>
  
  <p>What is the best way for doing this?</p>
  
  <ul>
  <li>Set a flag in the controller <code>$this-&gt;view-&gt;flagStatus = 'message'</code> then call it in the view?</li>
  </ul>
  
  <p>Just to make it more clear. It's my code:</p>
  
  <pre><code>//IndexController.php indexAction()
  
  ...
  
  //Check if there's submitted data
  if ($this-&gt;getRequest()-&gt;isPost()) {
      ...
      $registries-&gt;insert($data);
      $this-&gt;view-&gt;flagStatus = 'message';
  }
  </code></pre>
  
  <p>Then my view:</p>
  
  <pre><code>....
  &lt;?php if ($this-&gt;flagStatus) { ?&gt;   
      &lt;div id="divStatus" class="success span-5" style="display: none;"&gt;
          &lt;?php echo $this-&gt;flagStatus; ?&gt;
      &lt;/div&gt;
  &lt;?php } ?&gt;
  ....
  </code></pre>