3raser Posted March 7, 2012 Share Posted March 7, 2012 I've never really had this problem before. I'm trying to make it so only moderators can edit titles. This is currently my if statement: elseif($type == 2 && acc_status(getUsername()) > 1 && !isset($_POST['title']) || !isset($_POST['content'])) (I can assure you getUsername() works) Interpretation: If the editing type is 2 (thread/topic) and the user's account status is higher than 2 (meaning admin & mod) and the title or message/content isn't set, display the content within the if statement block. Why is it users with a user status of 1 can see the information within the block statement, allowing them to see the "edit title" field? Quote Link to comment https://forums.phpfreaks.com/topic/258426-if-statement/ Share on other sites More sharing options...
scootstah Posted March 7, 2012 Share Posted March 7, 2012 Because you're essentially saying "if this and this, OR this". See if this fixes it: elseif(($type == 2 && acc_status(getUsername()) > 1) && (!isset($_POST['title']) || !isset($_POST['content']))) This is saying "if this and this, AND this or this". Quote Link to comment https://forums.phpfreaks.com/topic/258426-if-statement/#findComment-1324703 Share on other sites More sharing options...
3raser Posted March 7, 2012 Author Share Posted March 7, 2012 Because you're essentially saying "if this and this, OR this". See if this fixes it: elseif(($type == 2 && acc_status(getUsername()) > 1) && (!isset($_POST['title']) || !isset($_POST['content']))) This is saying "if this and this, AND this or this". Thank you. I completely forgot about the use of nested if statements within an actual if statement. I'm sure there is a proper term for them, but I just can't seem to remember. Once again, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/258426-if-statement/#findComment-1324708 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.