2011-06-27 19 views
1

我想在輸入字段旁邊的成功插入後顯示消息,即時通訊使用窗體上的Zend驗證顯示驗證錯誤,但要確認用戶數據已添加到數據庫,有點卡住?代碼塊的成功插入到DB-Zend框架後,如何顯示用戶消息「添加新記錄」?

最後一節:

if (!$errors) { 
     // insert the details in the database 
     $data = array('OptionGroupName' => $_POST['OptionGroupName']); 

     $insert = $dbwa_ecommerce->insert('optiongroups', $data); 

     header('Location: testzendval.php'); 

     // want to show message on form after insert ? 

    } 

回答

4

您可以使用以FlashMessenger動作助手。您基本上使用助手在會話中放置消息並在重定向後檢索它。

手冊:http://www.framework.zend.com/manual/en/zend.controller.actionhelpers.html

這裏有一個博客文章,解釋如何做到這一點:http://akrabat.com/zend-framework/zend-frameworks-flash-messenger-action-helper/

+0

感謝的是, – Ledgemonkey

+0

你在哪裏把這個$本 - > _ helper-> flashMessenger->方法addMessage(「任務?保存'); $ this - > _ helper-> redirector('index'); – Ledgemonkey

+0

你在哪裏把這個 – Ledgemonkey

相關問題