Home arrow PHP arrow Performing Strict Validation with the Code Igniter PHP Framework

Performing Strict Validation with the Code Igniter PHP Framework

Welcome to the fifth article in our nine-part series on the Code Igniter framework. In the last article you learned a very simple way to use the framework to check information supplied by users through an HTML form. The type of checking done was very simple, however, and user-supplied data must be checked and validated pretty strictly for many purposes. This article will show you how to improve the previous application's validation mechanism.

TABLE OF CONTENTS:
  1. Performing Strict Validation with the Code Igniter PHP Framework
  2. Performing strict validation on user-provided data with Code Igniter
  3. Repopulating a web form with Code Igniter
  4. Completing the form validation application
By: Alejandro Gervasio
Rating: starstarstarstarstar / 4
September 10, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Code reusability is a well-known and powerful concept that provides PHP programmers with the capacity for developing complex web applications without having to “reinvent the wheel.” Naturally, in the area dominated by third-party frameworks this concept is really king, since the main goal of a development framework is to accelerate the creation of PHP programs through a set of classes and functions that can be reused any number of times.

Of course, when it comes to picking a particular PHP framework for rapid application development, there’s plenty of options available, and naturally each of them has its own pros and cons. However, before you start scratching your head over which package to choose, you should take a look at Code Igniter (http://codeigniter.com), a piece a software written in PHP 4 that lets you build full-blown PHP applications by using the Model-View-Controller pattern, and best of all, by means of a friendly programming interface.

And speaking of friendly things, you’ll possibly recall that in the previous installment of the series, I explained how to use Code Igniter’s validation class to perform a basic checking process on a simple web form. Essentially, the entire validation procedure was reduced to creating a controller class capable of verifying if each field of the form in question was left empty or not. That’s all.

In addition, based on the result of this process, the controller would either display a simple confirmation web page, or in the worst case, it would redisplay the sample web form, along with an error message indicating which fields should be populated correctly.

But, as I mentioned before, the checking process performed on this online form was pretty simplistic. In this fifth chapter of the series, I’m going to demonstrate how to use Code Igniter’s validation class to validate the data collected through a typical HTML form much more strictly, something that can be very useful for filtering user-supplied information.

Now, it’s time to jump forward and learn in a few easy steps how to perform strict validation on input data with Code Igniter. Let’s get started!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: