86Stang Posted February 24, 2009 Share Posted February 24, 2009 I'm building a member creation system and in lieu of using CAPTCHA I want to use a simple question that a bot could never answer. In my form I ask the question 'Is water wet or dry?'. Obviously the answer is 'wet' and I've got that check working well with the following: if ($_POST['security'] != 'wet'){ $message .= "<li>Your answer in the anti-spam field is incorrect.</li>"; } But if they respond with 'Wet' it kicks back the above message because of the uppercase w. So, do I need to do multiple IFs (and if so, how) or is there something where I can tell it to be case-insensitive? Quote Link to comment https://forums.phpfreaks.com/topic/146737-solved-multiple-matches-for-an-if/ Share on other sites More sharing options...
Philip Posted February 24, 2009 Share Posted February 24, 2009 if (strtolower($_POST['security']) != 'wet'){ Quote Link to comment https://forums.phpfreaks.com/topic/146737-solved-multiple-matches-for-an-if/#findComment-770369 Share on other sites More sharing options...
86Stang Posted February 24, 2009 Author Share Posted February 24, 2009 *hangs head in shame* So so simple... Just so I can say I learned something here, what your solution does is takes whatever they entered into the security field and converts it to all lowercase? Quote Link to comment https://forums.phpfreaks.com/topic/146737-solved-multiple-matches-for-an-if/#findComment-770373 Share on other sites More sharing options...
Philip Posted February 24, 2009 Share Posted February 24, 2009 That's correct Quote Link to comment https://forums.phpfreaks.com/topic/146737-solved-multiple-matches-for-an-if/#findComment-770374 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.