tet3828 Posted January 24, 2008 Share Posted January 24, 2008 what is the deal with the "OR" in the IF statement? I tried this: if ($_POST['sYear'] or $_POST['sDay'] or $_POST['sMonth']== xxx) { do whatever } Why isn't this working? My translation of the above is IF xxx is passed for either of these 3 variables Do this... What my malfunction here? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/87585-amateur-if-statement/ Share on other sites More sharing options...
revraz Posted January 24, 2008 Share Posted January 24, 2008 By saying just IF ($_POST['sYear'] you are checking if it exists, not if it == to xxx Also, it's better to use || instead of OR Quote Link to comment https://forums.phpfreaks.com/topic/87585-amateur-if-statement/#findComment-447964 Share on other sites More sharing options...
kenrbnsn Posted January 24, 2008 Share Posted January 24, 2008 You need to do each comparison: <?php if ($_POST['sYear'] == 'xxx' || $_POST['sDay'] == 'xxx' || $_POST['sMonth'] == 'xxx') { // do whatever } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/87585-amateur-if-statement/#findComment-447977 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.