How do I show user message "New Record added" after Successful insert into DB - Zend framework?
I want to show a message after Successful insert next to input field , im using zend validation on the form to display validation errors, but want to confirm to user that the data has been added to the db , getting a bit stuck ?
last section of code block:
if (!$errors) {
// insert the details in the database
$data = array('OptionGroupName' => $_POST['OptionGroupName']);
$insert = $dbwa_ecommerce->insert('optiongroups', $data);
header('Location: testzendval.php');
开发者_如何学JAVA // want to show message on form after insert ?
}
You can use the FlashMessenger action helper. You basically use the helper to put a message in the session and retrieve it after redirection.
Manual : http://www.framework.zend.com/manual/en/zend.controller.actionhelpers.html
Here's a blog post explaining how to do it : http://akrabat.com/zend-framework/zend-frameworks-flash-messenger-action-helper/
精彩评论