Lodius2000 Posted May 22, 2008 Share Posted May 22, 2008 Help...please, im trying to validate a text box to make sure that it is 14 characters or less, heres what I have if (trim(strlen($_POST['username'])) <= 14) { $errors[]= "Your username must be 14 characters or less."; } will make full code available if requested Thanks in advance Link to comment https://forums.phpfreaks.com/topic/106724-solved-validate-string-length/ Share on other sites More sharing options...
peranha Posted May 22, 2008 Share Posted May 22, 2008 you are giving them an error if it is less than or equal to 14, not greater than. if (trim(strlen($_POST['username'])) > 14) { $errors[]= "Your username must be 14 characters or less."; } Link to comment https://forums.phpfreaks.com/topic/106724-solved-validate-string-length/#findComment-547088 Share on other sites More sharing options...
Lodius2000 Posted May 22, 2008 Author Share Posted May 22, 2008 i hate my tired self Link to comment https://forums.phpfreaks.com/topic/106724-solved-validate-string-length/#findComment-547094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.