Php – player opening more than one time

htmlPHPxml

This is my site. When i will select songs for playing player.php file will open and it will play the songs selected.

Everything working fine,but the problem is when o will go back and select another songs it is opening one more player window. please help me.

I want only one player window has to be opened even i select other songs also.
to check the problem go to this url and play the songs once

player.php

createElement("playlist");
$dom->appendChild($root);
$root->setAttribute('version', "1");
$root->setAttribute('xmlns', "http://xspf.org/ns/0/");
$rootnext = $dom->createElement("trackList");
$root->appendChild($rootnext);
foreach ($song as $counter) {
    $tokens = ",";
    $tokenized = strtok($counter, $tokens);
// create child element

$song = $dom->createElement("track");
$rootnext->appendChild($song);
$song1 = $dom->createElement("creator");
$song->appendChild($song1);
$text = $dom->createTextNode("www.musicking.in");
$song1->appendChild($text); 
$song1 = $dom->createElement("title");
$song->appendChild($song1);
// create text node
$text = $dom->createTextNode($tokenized);
$song1->appendChild($text); 
$tokenized = strtok($tokens);
$song1 = $dom->createElement("location");
$song->appendChild($song1);
$text = $dom->createTextNode($tokenized);
$song1->appendChild($text); 

}
// save 
$dom->save("playlist.xml");
?>

playlist.xml


www.musicking.inDuryodhana's dialouge1/Ntr dialouges/duryodhana's dialouge.mp3www.musicking.inDuryodhana's dialouge2/Ntr dialouges/dvsk_dialogues-10.mp3www.musicking.inDuryodhana's dialouge3/Ntr dialouges/dvsk_dialogues-3.mp3www.musicking.inDuryodhana's dialouge4/Ntr dialouges/dvsk_dialogues-4.mp3www.musicking.inDuryodhana's dialouge5/Ntr dialouges/dvsk_dialogues-5.mp3www.musicking.inDuryodhana's dialouge6/Ntr dialouges/dvsk_dialogues-6.mp3www.musicking.inDuryodhana's dialouge7/Ntr dialouges/dvsk_dialogues-7.mp3www.musicking.inDuryodhana's dialouge8/Ntr dialouges/dvsk_dialogues-8.mp3www.musicking.inDuryodhana's dialouge9/Ntr dialouges/dvsk_dialogues-9.mp3www.musicking.inDuryodhana's dialouge10/Ntr dialouges/dvsk_dialogues-11.mp3www.musicking.inDuryodhana's dialouge11/Ntr dialouges/karna's dialouge.mp3

Best Answer

Alekc has it right.

Your form code is this:

<form method="post" action="/player.php" target="_blank"> 

You should change the target to something like player. This change will still cause the player to open in a new window, but that window will be uniquely named.

<form method="post" action="/player.php" target="player"> 

Then, when a user clicks on "Play Selected," instead of opening another window, it will load into the old player.