Using strip_tags for form validation with allowable_tags

codeigniter, strip-tags, validation

Solution

$this->form_validation->set_rules('description', 'Description', 'callback_description_check');

public function direction_check($str)
{
    return strip_tags($text, '<p><a>'); 
}

Best way would be to create your own callback function, which you can modify according to your needs.

Problem

It appears I can use PHP's strip_tags function within Codeigniter's form validation like this: ``` $this->form_validation->set_rules('description', 'Description', 'trim|xss_clean|strip_tags'); ``` Strip_tags supports an allowable_tags parameter to list tags to exclude from the filtering e.g. keep `<h1>`, `<strong>` etc. How can I use this within the form validation syntax?

Original source