[eluser]davidbehler[/eluser]
Ok, I have this setup:
form_validation.php in config folder:
Code:
$config = array
(
'post' => array
(
array
(
'field' => 'post_content',
'label' => 'Content',
'rules' => 'trim|required|xss_clean'
)
)
)
test.php in controller folder:
Code:
function post()
{
$this->load->library('form_validation');
if ($this->form_validation->run('post') == FALSE)
{
// show error message
}
else
{
// do some stuff
}
$this->load->view('post');
}
post.php in view folder:
Code:
echo form_open('test/post');
$data = array(
'name' => 'post_content',
'id' => 'post_content',
'cols' => '100',
'rows' => '5',
'value' => set_value('post_content')
);
echo form_textarea($data);
echo form_submit(array('value'=>'submit'));
echo form_close();
So far so easy, but now I got the following problem:
No matter what I enter into textarea, it seems like it's run through "htmlspecialchars", even though I have no such rule defined!
Example:
Entered value: <p>test</p>
"echo set_value('post_content');" BEFORE the validation is run: <p>test</p>
"echo set_value('post_content');" AFTER the validation is run: ltpgt;testlt;/pgt; (damn board keeps escaping my examples..)
Anyway, the first echo returns the value just like I entered it, the second one returns it as run through "htmlspecialchars" even though there is no such rule for that field!
Any ideas why?
Help appreciated!