Stefan83 Posted October 23, 2013 Share Posted October 23, 2013 Hi - I'm trying to echo different results if the current URL contains a certain query string. Ie if the URL contains ?fromAPP=1 OR ?fromQB=1 DO SOMETHING. I can't get the following to work. Can anyone help? Thanks $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (false !== strpos($url,'?fromApp=1,?fromQB=1')) { // do something } else { } Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 23, 2013 Share Posted October 23, 2013 (edited) Just check whether $_GET variables exist and set to 1 if( (isset($_GET['fromApp']) && $_GET['fromApp'] == 1) || (isset($_GET['fromQB']) && $_GET['fromQB'] == 1) { // url is either ?fromApp=1 OR ?fromQB=1 } Edited October 23, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Stefan83 Posted October 23, 2013 Author Share Posted October 23, 2013 Thanks but that's throwing errors? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 23, 2013 Share Posted October 23, 2013 (edited) Sorry, try if( (isset($_GET['fromApp']) && $_GET['fromApp'] == 1) || (isset($_GET['fromQB']) && $_GET['fromQB'] == 1)) { // url is either ?fromApp=1 OR ?fromQB=1 } I left of the closing ) for the if Edited October 23, 2013 by Ch0cu3r Quote Link to comment 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.