Skip to content
Advertisement

Codeigniter is giving me an error called “Disallowed Key Characters.”

I have a input with name=”exam[A+]”. I have figured out that when I called $this->input->post("exam") it is giving me an error called “Disallowed Key Characters”. I want to add + sign in my key characters. Here is the code in the system file.

JavaScript

How do I change the regular expression to add the + sign in the input?

Advertisement

Answer

Use this regex to allow +:

JavaScript

The main point is that the unescaped hyphen must be at the end of the character class.

Here is a demo.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement