Need help opening a new page..

Discussion in 'PHP' started by speedy23, Mar 20, 2008.

  1. #1
    I have to open multiple pages when hit a button. For example a user hits a button, and I have to open 5-6 new sites at different pages with specific urls.
    Is it possible with php or not?
     
    speedy23, Mar 20, 2008 IP
  2. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I doubt it, it'd probably be with javascript and window.open (5 times). I haven't tried it though, but there could be a minuscule chance browsers have some sort of anti-window-spamming sort of thing in place to prevent it.
     
    decepti0n, Mar 20, 2008 IP
  3. djliku

    djliku Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think this should work.

    <?php 
    	$windows = array('www.google.com','www.yahoo.com','www.msn.com'); 
    	foreach($windows as $key => $value) {
    		$open .= "window.open('http://$value','window$key');";
    	}
    ?>
    <a href="javascript:<?=$open?>" >Click Here</a>
    PHP:
     
    djliku, Mar 20, 2008 IP
  4. speedy23

    speedy23 Active Member

    Messages:
    399
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Thanks a lot!
    It works really good but just one problem. After opening these page, my main page goes to something like that:

    javascript:window.open('http://www.google.com','window0');window.open('http://www.yahoo.com','window1');window.open('http://www.msn.com','window2');

    I wanna my page does not change. Is it possible?
     
    speedy23, Mar 20, 2008 IP
  5. speedy23

    speedy23 Active Member

    Messages:
    399
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    djliku do you have any idea for staying at my page after opening these pages?
     
    speedy23, Mar 21, 2008 IP
  6. djliku

    djliku Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <a href="javascript:<?=$open?>" target="_blank">Click Here</a>
     
    djliku, Mar 25, 2008 IP