Help, conditional statement (if)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
michaeru
Forum Commoner
Posts: 28
Joined: Sun Mar 07, 2010 5:22 pm

Help, conditional statement (if)

Post by michaeru »

Just curious, by using the if (or if..else) statement how will you do trap the values if the entered value is not one of the following 'add', 'edit', 'delete'.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help, conditional statement (if)

Post by requinix »

With an else block.
michaeru
Forum Commoner
Posts: 28
Joined: Sun Mar 07, 2010 5:22 pm

Re: Help, conditional statement (if)

Post by michaeru »

>.< well, yes. But I'm interested only on the "if the value sent is not equal to either add, edit or delete". I do not need the "if the value sent is equal to either add, edit or delete".
ell0bo
Forum Commoner
Posts: 79
Joined: Wed Aug 13, 2008 4:15 pm

Re: Help, conditional statement (if)

Post by ell0bo »

do you mean...

if ( !($var === 'edit' || $var === 'save' || $var === 'delete') )

which is also...
if ( $var !== 'edit' && $var !== 'save' && $var !== 'delete )
Post Reply