开发者

How do I show user message "New Record added" after Successful insert into DB - Zend framework?

开发者 https://www.devze.com 2023-03-15 12:00 出处:网络
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 th

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号