aeafisme23 Posted September 11, 2008 Share Posted September 11, 2008 I have surfed around php.net and really did not find my answer which makes me think that I may be using the wrong method about how i should do this. Basically I have a drop down and when you hit submit it reads the variables to decide where its going to go. In this code if I were to select state: VA and city Richmond-Petersburg I have it redirecting to the URL http://www.thegreatestsave.org/wtvr-tgs. That works FINE. But what I want to do is for it to open two links instead of one so it opens the above link as well as Yahoo! header('Location: http://www.thegreatestsave.org/wtvr-tgs'); header('Location: http://www.yahoo.com'); Of course I already know putting two header locations will basically just cancel the first one out and execute the second. This is where I am lost. How do i process this? Another idea i had was inserting meta redirect instead of header location but like header you cant put 2 of them back to back or one will just get canceled out by the other. ob_start(); $state = $_GET['state']; $city = $_GET['city']; /* WTVR Richmond, VA */ if ($state == "VA" && $city =="Richmond-Petersburg"){ header('Location: http://www.thegreatestsave.org/wtvr-tgs'); } /* KBCI Boise, ID */ elseif ($state == "ID" && $city =="Boise"){ header('Location: http://www.thegreatestsave.org/kbci-tgs'); } etc...... * a small note after browsing forums to make sure this has not been answered... the url that its going to can not have code to pop up the window i want. So http://www.thegreatestsave.org/wtvr-tgs can not have a pop up that shows YAHOO because this drop down is only intended for select users to see this special pop up where the general public should only see http://www.thegreatestsave.org/wtvr-tgs unless they were to use the drop down method to get to the page. Thanks Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted September 11, 2008 Share Posted September 11, 2008 The only way i can think of doing it is having them click the links manually, e.g. <a href='mysitelink.php'>My Site link</a> <a href="http://exterenalsite.com" target="_blank">External site link</a> Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted September 11, 2008 Author Share Posted September 11, 2008 Let me see if i can put this another way that may be more efficient but still need help on how to accomplish it. Say if I do give into just the one redirect using the header location to http://www.thegreatestsave.org/wtvr-tgs .... which works just fine but instead i use the header location link to use a query string such as http://www.thegreatestsave.org/wtvr-tgs/index.php?somevariable=showpopup this would let me keep the integrity of the initial http://www.thegreatestsave.org/wtvr-tgs for those who dont use this dropdown so they would not see a pop up. Here is where I get lost now. Now i have this page http://www.thegreatestsave.org/wtvr-tgs/index.php "INDEX.php" that I need to alter the code so I can have a pop when somevariable=showpopup. index.php <?php if ($somevariable == "showpopup") { ******* this is where i need a pop up (when i say pop up; new window on top of index.php so if they are to close the page they are still looking at index.php) **** } else..... ?> Honestly after thinking about this, this is the way i need to go, but how do i accomplish the if statement to execute Thanks Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted September 11, 2008 Share Posted September 11, 2008 So you would need js to make a pop up, something like window.open("http://google.com","myWindow","status = 1, height = 300, width = 300, resizable = ") Should do , i think Quote Link to comment Share on other sites More sharing options...
aeafisme23 Posted September 11, 2008 Author Share Posted September 11, 2008 Thanks Blade but can you put Javascript like that with in a php IF statement if ($somevariable == "showpopup") { window.open("http://google.com","myWindow","status = 1, height = 300, width = 300, resizable = ") } which im assuming it would look more like this because the above would not execute anything that i know of. Put it in a .js file and then if ($somevariable == "showpopup") { <script type=javascript file=popup.js> } Ill check this out, if you think i misintepreted you let me know so it can save me time from trial and error ( i do know that I was just winging the html script above so i know i will correct in final version. Thanks Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted September 11, 2008 Share Posted September 11, 2008 This will work if ($somevariable == "showpopup") { ?> <script type="text/javascript"> window.open("http://google.com","myWindow","status = 1, height = 300, width = 300, resizable = ") </script> <?php } 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.