Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get my PHP application to re-use the same window for playing music?
    primarykey
    data
    text
    <p>Below is the code for my player which will automatically generate a <code>playlist.xml</code> file according to the songs selected by the user. I kept this file as <code>player.php</code> in my root folder, and in the form I give:</p> <pre><code>&lt;form method="post" action="/player.php" target="_blank"&gt; </code></pre> <p>so this player is opening and playing songs according to what is selected.</p> <p>But the problem is when the user again selects different songs while previously selected songs are playing in the player in new window, the new songs selected are opening in one more window, i.e. now two player windows are opened.</p> <p>Actually, I want the second selected songs will play in the same window which is already opened. You can check what's happening in my site by playing songs: <a href="http://www.musicking.in/hindi-songs/69.html" rel="nofollow noreferrer">http://www.musicking.in/hindi-songs/69.html</a></p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;?php if(isset($_POST["song"])&amp;&amp; $_POST['song'] != "") { $song = $_POST["song"]; } else { $song=array(); } for ($i="0"; $i&lt;count($song); $i++) { //echo $song[$i]; } //start of new php codep // create doctype //$array = array( // 'song.mp3','song.mp3','song.mp3', //); $dom = new DOMDocument("1.0"); // display document in browser as plain text // for readability purposes header("Content-Type: text/plain"); // create root element $root = $dom-&gt;createElement("xml"); $dom-&gt;appendChild($root); $i = "1"; foreach ($song as $counter) { // create child element $song = $dom-&gt;createElement("track"); $root-&gt;appendChild($song); $song1 = $dom-&gt;createElement("path"); $song-&gt;appendChild($song1); // create text node $text = $dom-&gt;createTextNode($counter); $song1-&gt;appendChild($text); $song1 = $dom-&gt;createElement("title"); $song-&gt;appendChild($song1); $text = $dom-&gt;createTextNode("song ".$i); $song1-&gt;appendChild($text); $i++; } // save and display tree //echo $dom-&gt;saveXML(); $dom-&gt;save("playlist.xml"); ?&gt; &lt;script type="text/javascript" src="swfobject.js"&gt;&lt;/script&gt; &lt;div id="flashPlayer"&gt; This text will be replaced by the flash music player. &lt;/div&gt; &lt;script type="text/javascript"&gt; var so = new SWFObject("playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF"); so.addVariable("autoPlay","yes") so.addVariable("playlistPath","playlist.xml") so.write("flashPlayer"); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload