This question already has answers here:
Closed 7 years ago.
Possible Duplicate:
CodeIgniter Disallowed Key Characters
When I check all the checkboxes (code below) it gives me this error:
Disallowed Key Character
Here's my HTML:
<label>Stability Control </label><input type="checkbox" class="largercheckbox" name="checkBox[Stability-Control]"></input><br/>
<label>Xenon Headlamps</label><input type="checkbox" class="largercheckbox" name="checkBox[Xenon-Headlamps]"></input><br/>
What's the problem here? I think my config file permits those characters:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
The following function found in system/core/Input.php
disallows the characters.
function _clean_input_keys($str) {
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) ...
This will allow a-z A-Z 0-9 : _ \ / -
You should extend the Input class by creating a MY_Input.php file in /application/core/
and recreate the method and add any characters you wish to allow. See Creating Core System Classes for an example as to how to achieve this.
However you should be careful with this as you could open up unnecessary security holes. You are better off rewriting your form so that it passes the existing validation.
Edit: This article describes both the problem and a solution as described above by extending the Input class.
Having searched, the following posts also demonstrate how this is accomplished to solve the same issue
Ok here is my answer
You have to go first to system/core/Input.php and look for a function called
_clean_input_keys($str)
I was don't know what is the character that is disallowed here so when you add the $str like the following
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
exit('Disallowed Key Characters.'.$str); // HERE
}
you will get exactly the character that cause the problem mine was ' ) ' so you have to do one of the following remove the disallowed character from the html or permit it like @Ben Swinburne said
Hope that help others