Ell20 Posted October 31, 2007 Share Posted October 31, 2007 Hey, Im attempting to create an OR statement so that only certain users will be able to see a certain option. Here is my code: if ($webtype == 'Cricket' || 'Football'){?> - Tennis users can still see the option - not working! I have also tried: if ($webtype == 'Cricket' | 'Football'){?> -Works as I want for Cricket (option visable) and Tennis (option not visable), however you cant see the option if Football Am I doing this wrong? Cheers Elliot Quote Link to comment https://forums.phpfreaks.com/topic/75525-solved-php-or-statement/ Share on other sites More sharing options...
Orio Posted October 31, 2007 Share Posted October 31, 2007 You need to mention the variable twice: if ($webtype == 'Cricket' || $webtype == 'Football'){?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/75525-solved-php-or-statement/#findComment-382077 Share on other sites More sharing options...
pocobueno1388 Posted October 31, 2007 Share Posted October 31, 2007 You need to mention the variable twice: if ($webtype == 'Cricket' || $webtype 'Football'){?> Orio. You forgot the '==' on the second one. if ($webtype == 'Cricket' || $webtype == 'Football'){?> Quote Link to comment https://forums.phpfreaks.com/topic/75525-solved-php-or-statement/#findComment-382079 Share on other sites More sharing options...
Orio Posted October 31, 2007 Share Posted October 31, 2007 lol right, fixed thanks Orio. Quote Link to comment https://forums.phpfreaks.com/topic/75525-solved-php-or-statement/#findComment-382081 Share on other sites More sharing options...
Ell20 Posted October 31, 2007 Author Share Posted October 31, 2007 Cheers guys, worked out needed the == when I got the parse error Quote Link to comment https://forums.phpfreaks.com/topic/75525-solved-php-or-statement/#findComment-382084 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.