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 *

Most Popular Posts

Avoid to use ENUM and SET type in MySQL

Posted on 6 years ago

Bhumi

How to use Template Parameter in Joomla

Posted on 5 years ago

Bhumi

How to use PHP Method Chaining?

Posted on 3 years ago

Bhumi

Overview of ECMAScript 6 new Features

Updated 18 years ago

Bhumi

Getting started with Amazon Web Services

Updated 18 years ago

Bhumi

Facade implementation in Laravel

Updated 18 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi