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 Link to comment https://forums.phpfreaks.com/topic/27436-setting-maximum-length-to-description-text-area/ 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] Link to comment https://forums.phpfreaks.com/topic/27436-setting-maximum-length-to-description-text-area/#findComment-125500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.