Thursday 15 March 2012

how retrieve inserted data when submit in same view page without refresh in codeigniter -


I have a product page, add both product forms and product lists here. I want that when I add a product, it will appear immediately in the product catalog content on the same page. My problem is, unless I refresh it does not display recent products.

It may be the problem at the bottom (enter the query again). I can solve this scratch style (without codeigniter). But how is the codeigniter that is my controller product ()

  public function product () {$ data ['title'] = 'product'; // The first letter is $ this-> Load-> View ('templates / header', $ data) capitalization; $ This- & gt; Form_validation- & gt; Set_reales ('product', 'product', 'required | min_longham [7] | max_long [7] | numeric'); $ This- & gt; Form_validation- & gt; Set_rels ('buy_price', 'purchase price', 'required | numeric'); $ This- & gt; Form_validation- & gt; Set_rels ('sell_price', 'cell price', 'required | numeric'); If ($ ----- form_validation- & gt; run) == incorrect) {$ data ['product'] = $ this- & gt; Admin_model- & gt; Show_product (); // My selected query $ this-> Load-> View ('admin_panel / product', $ data); } And {$ data ['product'] = $ this- & gt; Admin_model- & gt; Show_product (); // My selected query $ this-> Load-> View ('admin_panel / product', $ data); $ This- & gt; Admin_model- & gt; Add_product (); // my query query} $ the-> Load-> View ('Template / Footer');    

Collecting and retrieving data is the same view

 < Code> Public Function Category 1 () {$ this- & gt; Form_validation- & gt; Set_rules ($ this-> config- & gt; items ('category_settings')); $ This- & gt; Form_validation- & gt; Set_error_delimiters ('', ''); If ($ -> - form_validation- & gt; play ('submit') == incorrect) {// display records $ data ['category1'] = $ this- & gt; Category_model- & gt; Display_category1 (); $ This- & gt; Load-> ('Admin / add_category1', $ data) view; } Else {// Add Record $ this-> Add_category1 (); }} Public function add_category1 () {// $ parent_category = $ this- & gt; Input-> Post ('parent_category'); $ Data = array ('parent_category_name' = & gt; $ this-> input- & gt; post ('parent_category')); $ Insert_category1 = $ this- & gt; Category_model- & gt; Add_category1 ($ data); If ($ insert_category1) {$ this- & gt; Session-> Set_flashdata ('item', 'category successfully added'); Redirect (base_url ('admin / category / CATEGORY1')); }}    

No comments:

Post a Comment