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

  • 2
    You should add valid route to form action. Also you should have form_key field in your form otherwise you will be taken to dashboard. Feb 4, 2013 at 15:46
  • @PetarDzhambazov I see. I will search information about how to do it with the 'form_key' then. Thanks!!
    – inavas
    Feb 4, 2013 at 15:50
  • @PetarDzhambazov Ok, I've read about what you said but it still happens the same. In the form action I put <?php echo $this->getFormAction(); ?> and I added an input hidden like: <input type="hidden" name="form_key" value="<? echo $this->getFormKey(); ?>" /> but it continues going to the dashboard... Do you see something wrong? Do you know how to put it in other way? Or I don't know what to do now.. Thanks a lot.
    – inavas
    Feb 4, 2013 at 16:49
  • 1
    $this->getFormAction(); is not enough, you have to set it before that. See BOOMER's response for a hint what your action should be. Feb 4, 2013 at 19:17

1 Answer 1


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.


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() ?>" />

  • Thanks a lot, it works!! I put that input hidden with Mage::getSingleton('core/session') and now works. Thank you both.
    – inavas
    Feb 5, 2013 at 15:44

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.