jimleeder123 Posted July 11, 2016 Share Posted July 11, 2016 I'm editing the Woocommerce e-mail files, and have got a session working. When it's echoed on the e-mail it appears as expected - "1 Day Health & Safety Awareness Chelmsford". However the if statement is not working. This is shown below, can anyone tell me where I'm going wrong? if (strpos($_SESSION['ahsname'], 'safety awareness') !== false) { // This is what I want to happen, the session should (and does) contain the string shown above //include( get_template_directory() . '/instructions/chelmsford-hsa-ahs.html'); echo "YES"; }else{ // This should not happen but it does! echo "NO "; echo $_SESSION['ahsname']; // the session is echoed with the bit I'm checking for included as mentioned above } Quote Link to comment https://forums.phpfreaks.com/topic/301463-string-check-on-session/ Share on other sites More sharing options...
ginerjm Posted July 11, 2016 Share Posted July 11, 2016 case sensitive? Quote Link to comment https://forums.phpfreaks.com/topic/301463-string-check-on-session/#findComment-1534416 Share on other sites More sharing options...
jimleeder123 Posted July 12, 2016 Author Share Posted July 12, 2016 Ok you have permission to send an army after me, you were right. I swear it wasn't working yesterday. Very odd, but it works now! Quote Link to comment https://forums.phpfreaks.com/topic/301463-string-check-on-session/#findComment-1534432 Share on other sites More sharing options...
ginerjm Posted July 12, 2016 Share Posted July 12, 2016 You should still alter it to handle case sensitivity!!! Read The Manual! Quote Link to comment https://forums.phpfreaks.com/topic/301463-string-check-on-session/#findComment-1534439 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.