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