jarvis Posted March 30, 2011 Share Posted March 30, 2011 Hi, I can't see for looking on quite simply a very easy statement; $cartTotal = '900'; echo 'cart total '.$cartTotal.'<br/>'; $postage = '100'; echo 'Postage '.$postage.'<br/>'; $postThreshold = '85'; echo 'Post Threshold '.$postThreshold.'<br/>'; if ($cartTotal <= $postThreshold) { echo 'too little'; } elseif (($cartTotal >= $postThreshold) || ($cartTotal <= $postage)) { echo 'difference'; } else { echo 'over a ton'; } It works apart from if the cart total is above 100. What have I missed? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/232161-php-if-elseif/ Share on other sites More sharing options...
KevinM1 Posted March 30, 2011 Share Posted March 30, 2011 What results are you expecting to get? Quote Link to comment https://forums.phpfreaks.com/topic/232161-php-if-elseif/#findComment-1194249 Share on other sites More sharing options...
jarvis Posted March 30, 2011 Author Share Posted March 30, 2011 Hi, If the cart total is less than 85 - too little If its between 85 - 100 - difference Above 100 - over a ton Thanks for looking Quote Link to comment https://forums.phpfreaks.com/topic/232161-php-if-elseif/#findComment-1194254 Share on other sites More sharing options...
KevinM1 Posted March 30, 2011 Share Posted March 30, 2011 Change the || to && Quote Link to comment https://forums.phpfreaks.com/topic/232161-php-if-elseif/#findComment-1194258 Share on other sites More sharing options...
jarvis Posted March 30, 2011 Author Share Posted March 30, 2011 D'oh! Thanks that's worked a treat!! Quote Link to comment https://forums.phpfreaks.com/topic/232161-php-if-elseif/#findComment-1194263 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.