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.