PHP / mySQL 3 comments
In CakePHP it is possible to make rules to validate form post values. In the model you use $validate as an array of validation rules.

Usually this would look like this:
 to view the code read the full post

This is all good unless somebody is inserting spaces. At that point the validation returns true and saves spaces into your database table. I guess that is not the desired result. One solution would be to trim individually every input in the controller before validation. That would result in too many lines. CakePHP should have this built in.

The other solution for doing this and loosing those extra lines it is to put the following code in your app_controller.php:
 to view the 
 ...read more
Pages: 1