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.

1 Answer 1

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();
6
  • it is not working : Mage::getSingleton(‘core/session’)->setFormData($data); $data = Mage::getSingleton(‘core/session’)->getFormData(); Commented Sep 19, 2017 at 10:06
  • What error you are getting ? can you try with one simple varible first Commented Sep 19, 2017 at 10:10
  • same empty array, after using core/session Commented Sep 19, 2017 at 10:12
  • Which class your controller extending ? Commented Sep 19, 2017 at 10:17
  • class Custom_Inquiry_IndexController extends Mage_Core_Controller_Front_Action Commented Sep 19, 2017 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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