TheJoey Posted September 7, 2009 Share Posted September 7, 2009 I currently have this. if ($age <16 && $age >90) $errorAge = true; Although it doesnt display any error for age althought if i want to test the code and put if (strlen($age)<1) $errorAge = true; it displays the error i want. So im guessing its the validation technique im trying to use. Link to comment https://forums.phpfreaks.com/topic/173386-solved-validation-of-age/ Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 You're using the wrong operator. It is impossible for $age to be less than 16 AND greater than 90. Use OR: if ($age < 16 || $age > 90) $errorAge = true; Link to comment https://forums.phpfreaks.com/topic/173386-solved-validation-of-age/#findComment-913996 Share on other sites More sharing options...
TheJoey Posted September 7, 2009 Author Share Posted September 7, 2009 thank you so much mate. Link to comment https://forums.phpfreaks.com/topic/173386-solved-validation-of-age/#findComment-913999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.