Question

I've created a new menu on the backend, which has a form. I need to pick the form's data and show them in the same .phtml or another, I don't mind. But the fact is that I can't do a <form action="" method="POST"> because when I click on the button and the page is refreshed, it returns me to the main control pannel, so I can't pick the data. And when I try to send the data to another .phtml, it happens to me the same, maybe it's because I'm putting the second .phtml (the phtml with de $_POST vars) in the wrong directory, but I'm not sure. Both .phtmls are in the same folder: /app/design/adminhtml/default/default/template

Was it helpful?

Solution

As Petar stated secret form key is enabled and you are being reverted back to the dashboard.

You can determine if this is enabled by viewing the table core_config_data and viewing the XPath: admin/security/use_form_key if it is set to 1, then it is enabled and is advised to keep it as such as it is a security measure.

Example:

echo Mage::helper("adminhtml")->getUrl("module_name/controller_name/action_name/",array("param1"=>1,"param2"=>2));

Take a look at Mage_Core_Model_Session::getFormKey, which is referenced by adminhtml/url. This should give you more insight into how those URLs are generated.

Also, in your .phtml use the hidden input field as such:

<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top