Back to Top

How to Prepare data in CodeIgniter

Prepping Functions in CodeIgniter

We’ve looked basics about CodeIgniter at here which is about installation steps and basics about CodeIgniter. Today I am going to cover prepping functions used in CodeIgniter.

There are various prepping functions in CodeIgniter and prepping functions are used to prepare the data before passing it to views or apply validation rules.

Let’s see the some prepping functions:


Here is the syntax for prep_url:

prep_url ( $str = '' )


$str is the URL String which is optional, you can pass the URL.This function returns protocol-prefixed URL string and return type are string.

When the URL protocol prefix part is missing, use this function will be added to the URL HTTP & # 58; and //.

Like the use of the following function:

The first and simple function prep_url will just add http:// to a URL, if it is missing.


The prep_for_form function will convert special characters so that HTML data can be shown in a form without breaking it.


The xss_clean function is used to strips out any code and to remove unused characters and replace those with HTML entities.


Basically strip_image_tags function will remove image tags and leave the RAW image URL.


This function will convert PHP tags into entities.Above functions have optional parameters.

Suggested Reading:

Get IP address in CodeIgniter
Codeigniter _remap function

If you like this article and find it to be informative, don’t forget to tweet it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to Add Tag in WordPress

Posted on 7 years ago


How to perform Operations in LESS CSS?

Posted on 4 years ago


How to convert Object to array in PHP

Posted on 2 years ago


Hello world

Updated 1 month ago

Nick Carter

In depth Understanding of Laravel Core

Updated 3 months ago


ECMAScript 6 New Features – 2

Updated 1 year ago


The Reader’s Poll – June 2015

Posted on 4 years ago


The Reader’s Poll – August 2014

Posted on 5 years ago


The Reader’s Poll – June 2014

Posted on 5 years ago


The Readers’ Poll – May 2014

Posted on 5 years ago


The Readers’ Poll – August 2013

Posted on 6 years ago