Magento 1.7 Product Forms – Invalid Form Key Error on Product Save

formsmagento-1.7product

Hello All
I am getting this error "Invalid Form Key. Please refresh the page." whenever I try to save my product on admin panel.
I have gone through this link here but no success.
When I looked at my log file it displayed me this

2013-09-03T07:07:43+00:00 ERR (3): Notice: Undefined index: httponly  in /var/www/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 94
2013-09-03T07:07:43+00:00 ERR (3): Notice: Undefined index: secure  in /var/www/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 96
2013-09-03T07:07:43+00:00 ERR (3): Notice: Undefined index: domain  in /var/www/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 98

I commented out the lines in the file as suggested in this article here. And the errors in log files were gone. But still not able to save my product and the error "Invalid Form Key. Please refresh the page." is as it is.
I checked the post data in firebug and it showed me

form_key    THJDhxajLIZnzrHt
form_key    {{formKey}}

as form key variables passing when I save my product. When I checked it in my local machine it displays me

form_key    prvOwOCGjSKG6DpF
form_key    {{formKey}}
form_key    prvOwOCGjSKG6DpF

something like this.

Does anyone have any idea what is wrong here. Here I can see that the last value for "form_key" passing in live is "{{formkey}}" while in local it is "prvOwOCGjSKG6DpF". Any help is appreciated.

Best Answer

There is one more source for this error: a wrong cookie_domain in the configuration. As you can't login into the admin area, you can check it directly via mysql:

SELECT * FROM core_config_data WHERE path LIKE '%cookie_domain%';

You can change the value in mysql directly as well. Don't forget to clear the cache afterwards.