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:

prep_url

Here is the syntax for prep_url:

Parameters:

$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.

prep_for_form

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

xss_clean

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

strip_image_tags

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

encode_php_tags

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 use _remap function Codeigniter

Posted on 12 years ago

Bhumi