Jump to content

[SOLVED] Passing a variable through url, while already passing a url variable...


swampdiner

Recommended Posts

Sorry for the confusing subject, but let me clarify. I am trying to set up a media player that reads a on the fly generated php playlist. What I would like to do is pass a variable to the playlist_generator.php file. I am successful when passing it straight to it, but the media player needs to pass the variable and I don't know how to tell it that it's for the playlist.php file and for it. Sounds confusing ha. Here is what i mean-

<embed src="xspf_player.swf?playlist_url=playlist_generator.php?path=$path&autoload=true&autoplay=true"

How can I distinguish that I want to pass the $path variable to the playlist_generator in

playlist_generator.php?path=$path

and not to the swf? I feel like there is a simple answer, but I have no idea what keywords I should have googled.

Thank you in advanced.

playlist_generator.php needs to echo the playlist <location></location>

 

so make $path an id and get the info from the database

 


$path = $_GET['path'];

if ($path !=""){
$query = "SELECT * FROM video WHERE file_id='{$path}' ";
$result = mysql_query($query)or die(mysql_error());

echo '<?xml version="1.0" encoding="UTF-8"?><playlist xmlns="http://xspf.org/ns/0/" version="1"><title>mixmedia</title> <tracklist>';

$row = mysql_fetch_array($result);

        $file = "/files/".$row['swfname']; //location of file here


    echo"<track>
      <location>".$file."</location>
    </track>";
   

echo '</tracklist></playlist>';
}

I appreciate your replay, but I don't have any problems with the actual playlist_generator.php page. My problem was passing it a variable in that embed source because it was already taking variables and there was no way to distinguish that the variable was supposed to go to the generator. What I did to solve this was to give up trying to send the variable through the url and just created a shortlived cookie instead. Thanks for the quick reply.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.