Do this by putting a MY_Form_file in your application/libraries folder.This file should look like this: This is a very elegant solution, and I would like to recommend an additional change to allow better customisation.Although there is nothing terribly complex about the above process, it usually requires a significant amount of code, and to display error messages, various control structures are usually placed within the form HTML.Form validation, while simple to create, is generally very messy and tedious to implement.You may consider a callback that implements PHP's Date Time class.Invalid input would return false and the callback would do the same.
How you decide to approach the callback will be dependent on your needs and the kind of input you're asking for and expecting to receive.
Example: The first parameter must contain a Unix timestamp.
The second parameter must contain a timestamp that is greater that the first timestamp.
This function is identical to PHPs date() function, except that it lets you use My SQL style date codes, where each code letter is preceded with a percent sign: %Y %m %d etc.
The benefit of doing dates this way is that you don't have to worry about escaping any characters that are not date codes, as you would normally have to do with the date() function.