How do I open multiple browser windows on demand? (PHP)

So, I have a form on a page PHP/HTML

. The user sends it to the same page PHP/HTML

. So now in the PHP page I will have the data $_POST

. I want the page to refresh in some popUp browser windows, the url of which will be relative to the users request POST

. egwww.example.com/bal-bla-bla.php? id=$_POST['StreamId']

+2


a source to share


3 answers


if ( isset($_POST['submit']) ) {

echo '<script>window.open ("'.$_SERVER['PHP_SELF'].'myplayer.php?stream_id='.$_POST['StreamId'].'","myplayer");</script>';

}

      

edited:



you can always display a message before opening a window that advises the user to accept this new window!

var flag = confirm(" This window is not an ADV! ;-) ");
if (flag)
window.open("'.$_SERVER['PHP_SELF'].'","myplayer");

      

+5


a source


Include some <script>

elements with window.open

calls in them in response ... then watch the popup blocker block them in the world.



+6


a source


You will need to do this client side in javascript.

You can use window.open () in your document.onload event handler.

However, there is a chance that the user has a pop-up blocker that will be blocked.

+1


a source







All Articles