lynxus Posted January 20, 2008 Share Posted January 20, 2008 Hi, I have a problem with frames and php. I have a page that has a bunch of frames inside it. Inside one of those frames i have some php code that does stuff. However i want it to check if something exists inside the url of the main windows URL. IE: The main windows url = http://Moooooooo.com/login.html?ChangeMe|||||||||0|0|0||SomeWord|1|0 Then inside that main window is a frame with bla.html and some php code in it. In blaa.html i want to look at the main URL and say, if it finds SomeWord inside that big url is prints one thing and if it doesnt it does something else.. Maybe if tru set $var = "1" else "0" Sorta like lest say.. $var = "0"; if ($url of main window contains "SomeWord") { $var = "1"; }else{ $var = "0"; } Any ideas??? Thanks so much Graham Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/ Share on other sites More sharing options...
phpQuestioner Posted January 21, 2008 Share Posted January 21, 2008 try this: <?php $var1 = $_SERVER['QUERY_STRING']; $lookN4="SomeWord"; // Word You Want To Search For if (preg_match("/$lookN4/i", $var1)) { echo "Query String Did Contain \"$lookN4\"."; } else { echo "Query String Did <b><u>Not</u></b> Contain \"$lookN4\"."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-444814 Share on other sites More sharing options...
resago Posted January 21, 2008 Share Posted January 21, 2008 php won't know what was in another frame. use javascript. Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-444819 Share on other sites More sharing options...
lynxus Posted January 21, 2008 Author Share Posted January 21, 2008 Doesnt seem to work.. Whats really odd is that code sorta stops working half way through... It just prints this in the page thats in an frame of the main page.. Not Contain \"$lookN4\"."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-445166 Share on other sites More sharing options...
lynxus Posted January 21, 2008 Author Share Posted January 21, 2008 Wouldnt of thought PHP would have problem's finding out what the main URL is of the (Mainframe) from a page inside a frameset?? Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-445171 Share on other sites More sharing options...
lynxus Posted January 21, 2008 Author Share Posted January 21, 2008 ah ok, Managed to the script to run.... Server was playing up.. Anyway. It doesnt seem to find the word in the url of the main window from the frame Any ideas? Thanks Graham Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-445181 Share on other sites More sharing options...
lynxus Posted January 21, 2008 Author Share Posted January 21, 2008 The $var seems to be empty Any ideas? http://brokentrumpet.star.net.uk/imchat/ Link to my test page. Quote Link to comment https://forums.phpfreaks.com/topic/86913-search-for-word-inside-of-main-window-url/#findComment-445184 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.