darkfreaks Posted February 7, 2008 Share Posted February 7, 2008 need help with modding my statement. so it is <?php if($age<18) { echo "You can not add this user for security reasons";}?> but i also want it to search the user who is trying to add te under age user and get there age and if they are above 18 to not allow them to add that user but i still want other teenagers below 18 to still be able to add each other. Link to comment https://forums.phpfreaks.com/topic/89977-solved-if-statement-help/ Share on other sites More sharing options...
roopurt18 Posted February 7, 2008 Share Posted February 7, 2008 I don't see why you had to go and create a second topic on this. But... The logic you want is: If both users are under 18 OR both users are 18 and over Then they can add each other. if($age1 < 18 && $age2 < 18 || $age1 >= 18 && $age2 >= 18){ // then add }else{ // fail } But I don't see this is a very realistic solution. Why should a 17 year old not be able to add an 18 year old (assuming this is a facebook or myspace type site)? Link to comment https://forums.phpfreaks.com/topic/89977-solved-if-statement-help/#findComment-461305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.