0

http://localhost/testsetup/index.php/inquiry/index/index

echo "<pre>"; print_r($data); die;

Array
(
    [qty] => 1
    [product] => 486
)

Case 1. When i press ctrl+f5 (reload the inquiry page) , Array data is there. This is ok for me.

Array
(
    [qty] => 1
    [product] => 486
)

case 2. Array data is empty. When i hit the URL of page.

 Array
    (

    )

How to solve case 2 so that array data is not empty when i hit the URL.

0

If Form Data is posted on URL and If you refresh the Page, Form Data will be lost.

To keep the form data, you need to save in Session like below:

Mage::getSingleton(‘core/session’)->setFormData($data);
$data = Mage::getSingleton(‘core/session’)->getFormData();

After completing your all work, You can remove the unset the session like below:

Mage::getSingleton(‘core/session’)->unsFormData();
  • it is not working : Mage::getSingleton(‘core/session’)->setFormData($data); $data = Mage::getSingleton(‘core/session’)->getFormData(); – abhishek Sep 19 '17 at 10:06
  • What error you are getting ? can you try with one simple varible first – Pankaj Pareek Sep 19 '17 at 10:10
  • same empty array, after using core/session – abhishek Sep 19 '17 at 10:12
  • Which class your controller extending ? – Pankaj Pareek Sep 19 '17 at 10:17
  • class Custom_Inquiry_IndexController extends Mage_Core_Controller_Front_Action – abhishek Sep 19 '17 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.