CodeIgniter - disallowed key characters

Possible Duplicate:
CodeIgniter Disallowed Key Characters

I have a bit of an issue with a form I'm trying to submit, its dynamic and the checkbox values come from the database, only problem is that one of the fields has a # and when I try to submit the form, it returns 'disallowed key characters'.

How do i make it ok to submit a # ?


ANSWERS:


As per your question it seems that you are using get as a method in the form and because of that it is giving disallowed key characters error.

To allow the character # just add it in the following in your CONFIG file -

$config['permitted_uri_chars'] = '\#';

And now the character # will be allowed in the url.


It's hardcoded into the Input class in the function _clean_input_keys().

Just create a MY_Input class and override the function.

/**
* Clean Keys
*
* This is a helper function. To prevent malicious users
* from trying to exploit keys we make sure that keys are
* only named with alpha-numeric text and a few other items.
*
* @access   private
* @param    string
* @return   string
*/
function _clean_input_keys($str)
{
    // if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) <---- DEL
    if ( ! preg_match("/^[#a-z0-9:_\/-]+$/i", $str)) // <----INS
    {
        exit('Disallowed Key Characters.');
    }

    // Clean UTF-8 if supported
    if (UTF8_ENABLED === TRUE)
    {
        $str = $this->uni->clean_string($str);
    }

    return $str;
}

replace :

      if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))

with this :

      if ( ! preg_match("/^[#a-z0-9:_|\/-]+$/i", $str))

in system/core/input.php



 MORE:


 ? codeigniter Disallowed Key Characters - when all characters are allowed
 ? Disallowed Key Characters when doing an AJAX POST
 ? codeigniter Disallowed Key Characters error
 ? CodeIgniter with Firefox and Disallowed Key Characters
 ? Codeigniter 2.1, jquery - ajax(post) disallowed key characters
 ? CodeIgniter : Disallowed key Characters in Chrome
 ? CodeIgniter: Disallowed Key Characters
 ? CodeIgniter: Disallowed Key Characters.<?xml_version
 ? CodeIgniter - disallowed key characters
 ? "Disallowed Key Character" error in CodeIgniter?