Tiffany B. Brown

a mish-mosh of stuff

CodeIgniter’s “Disallowed Key Characters” error revisited

Two years ago, I posted about CodeIgniter‘s “Disallowed Key Characters” error message, and one possible cause.

Recently, I stumbled across another cause: disallowed characters in a POST array. In my case, I had single-quotes as part of the variable name. My fingers mixed up PHP array syntax and HTML form syntax.

<!-- will cause the error -->
<input type="text" name="fieldname['foo']" value=""> 

<!-- won't cause the error. besides, this is the proper syntax. -->
<input type="text" name="fieldname[foo]" value="">

kalodont points out this can also happen when using accented characters, such as ó or ñ as keys in your array.

  • Utah_Dave

    I got this same error when I had spaces in the array key names.

  • Ashek

    Also, this error can be produced by invalid cookie value.. Just faced such a case. Hope that helps.. :-)

  • Anonymous

    Wow. I was using jQuery UI’s tab feature with the optional cookie feature and the default cookie set by UI tabs was the problem. I deleted the cookie and all was well.

  • Anonymous

    The problem is the default name used by UI tab for the cookie. The default name is something like ui-tabs-[object Object]. If you specifically set the name of the cookie to something without braces, it fixes the problem.

    $(“#stuff”).tabs({
    cookie: { name: ‘mycookie’ }
    });

  • Kanaka

    I also got this error when I messed up a cut and paste:

    $email_map['$email_type_id']

    Should be:
    $email_map['email_type_id']

  • mark

    Simple HTML Error with 

    I didn’t close the name field in the HTML element.

  • Ttray

    i think it is the setting of the CI ! pls check the config.php

    http://www.007daigou.com
    007daigou.com