Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5838371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:27:39+00:00 2026-05-22T11:27:39+00:00

How do you remove ALL HTML tags with codeigniter? im guessing you would have

  • 0

How do you remove ALL HTML tags with codeigniter? im guessing you would have to use the PHP function strip_tags, but I wanted something like the global setting for XSS filtering

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:27:39+00:00Added an answer on May 22, 2026 at 11:27 am

    If you’re referring to using the input methods, Yes, you could technically open up system/libraries/Input.php, head down to this code:

    /**
    * Clean Input Data
    *
    * This is a helper function. It escapes data and
    * standardizes newline characters to \n
    *
    * @access   private
    * @param    string
    * @return   string
    */
    function _clean_input_data($str)
    {
        if (is_array($str))
        {
            $new_array = array();
            foreach ($str as $key => $val)
            {
                $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
            }
            return $new_array;
        }
    
        // We strip slashes if magic quotes is on to keep things consistent
        if (get_magic_quotes_gpc())
        {
            $str = stripslashes($str);
        }
    
        // Should we filter the input data?
        if ($this->use_xss_clean === TRUE)
        {
            $str = $this->xss_clean($str);
        }
    
        // Standardize newlines
        if (strpos($str, "\r") !== FALSE)
        {
            $str = str_replace(array("\r\n", "\r"), "\n", $str);
        }
    
        return $str;
    }
    

    And right after the xss clean, you could put your own filtering function like so:

    // Should we filter the input data?
    if ($this->use_xss_clean === TRUE)
    {
        $str = $this->xss_clean($str);
    }
    
    $str = strip_tags($str);
    

    However this means that everytime you update CodeIgniter, you will have to make this change again. Also since this does all of this globally, it won’t make sense if the value you’re getting back is, say for example, numeric. Because of these reasons

    Code Igniter Cat Does Not Approve

    Now for an alternative solution, you can use the CodeIgniter Form Validation library, which let’s you set custom rules for fields, including php functions that can accept one argument, such as strip_tags:

    $this->form_validation->set_rules('usertext', 'User Text', 'required|strip_tags');
    

    I’m not sure what the circumstances are, so I’ll let you decide which path to take, but in general I recommend handling data validation on a per case basis, since in a majority of cases the validation on the data is unique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have downloaded a page using urlopen. How do I remove all html tags
I need to use javascript to remove all html tags, except for those I
is it possible to use the jquery text() function to remove all HTML in
I receive a string from a database query, then I remove all HTML tags,
I want regular expression in ruby on rails which remove all the html tags
I am using this pattern to remove all HTML tags (Java code): String html=text
My input is plain text string and requirement is to remove all html tags
Is it possible to use regex to remove HTML tags inside a particular block
I need to learn how to remove html tags using PHP. This is what
I am trying to remove all the html tags out of a string in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.