I am using codeigniter php MVC framework to develop a web application. I have an input textarea that I would like to validate the input on. Basically it is similar to the textarea that I am typing in right now for stackoverflow, minus most (maybe all) of the formatting features that it has. Is there a simple built in way of doing this in codeigniter? If not, what would be the best way to approach this? Basically I want the input filtered and formatted properly both before writing to the database and also for retrieving the text for display on the page. I assume I would need all the basic regex checks and character escaping (like double quotes etc.) as well as sql injection protection. Thanks in advance!
What you're trying to do sounds more like sanitizing your input, not validating. If you use CodeIgniter's ActiveRecord functions, you will be protected from SQL injections. For everything else, you'll have to write on your own code, probably in a function in your model before you send it to the database.
you can use the same SO editor or markdown or a regular WYSIWYG for user's input.
Regarding security or sql injection, look at html purifier. you have a nice comparative here that can help you to see which one is the best for you... remember that more rules to check usually means more overhead
CodeIgniter has its own Form Validation library. See link text.
It "... provides a comprehensive form validation and data prepping class that helps minimize the amount of code you'll write."
Of course, it is server-side validation. You might want to look at jQuery's Validation plugin for your client-side validations. See link text.