codeigniter csrf error on form submission codeigniter csrf error on form submission codeigniter codeigniter

codeigniter csrf error on form submission


you are doing it wrong.

try this

    <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash();?>" />

the value must be what codeigniter calculates for the csrf token.

or use form helper and codeigniter will add this hidden field automatically.


In my case I just increased 'csrf_expire' variable - the number in seconds the token should expire.

From $config['csrf_expire'] = 7200; To $config['csrf_expire'] = 28800;


change $config['csrf_regenerate'] = TRUE;

to

$config['csrf_regenerate'] = FALSE; in config file