dc_jt Posted November 16, 2006 Share Posted November 16, 2006 I have a validation function like this:[code]private function ValidateData($aPostData) { //If normal listing if ($aPostData['iTypeId'] == 1){ //check all fields if (trim($aPostData['name']) == "") return false; if (trim($aPostData['address']) == "") return false; if (trim($aPostData['postcode']) == "") return false; if (trim($aPostData['telephone_number']) == "") return false; if (trim($aPostData['fax']) == "") return false; if (trim($aPostData['email']) == "") return false; if (trim($aPostData['description']) == "") return false; return true; //All larger Ads }else{ if (trim($aPostData['name']) == "") return false; return true; } }//end function[/code]I want to add something so that the user cant enter more than 120 characters in the description box.How could I add this?Thanks Quote Link to comment Share on other sites More sharing options...
alpine Posted November 16, 2006 Share Posted November 16, 2006 strlen()[code]<?phpif (strlen(trim($aPostData['description'])) > 120) return false;?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.