Search code examples
symfony1doctrinesymfony-1.4

Symfony CSRF attack detected everytime I submit a form


The login form works fine, but any other form I submit (things like editing or creating data) I get a CSRF attack detected error. I have tried to clear symfony and browser cache, deleted cookies, tried multiple browsers and multiple computers.

What can cause this? When I turn off the CSRF protection it works fine.


Solution

  • Every time I got this error in the past it was because I forgot to render hidden tags in my form. Don't forget to add this line:

    <?php echo $form->renderHiddenFields() ?>