hi frnds, i have issue with my simple script
i have audios.php file white fetch all mp3 audio files on the audios.php file
i want if someone click on the executed mp3s which makes this type of hyper link
http://xyz.com/uploads/123.mp3 its prompt for download and save file option i dont want that
if someone click to audio file it should play with html5 <audio> tag on another page for example play_audio.php i don't know how to link these both pages with each other and how i make difference b/w these two files, i want if someone click any audio file ti should play on another page which i mentioned above.
here is my audios.php page coding

<?php
include ("header.html");
include ("config.php");
?>
<div style="background-color:red; color:white; text-decoration:none;">
    <?php
    $records = mysql_query ("SELECT * from songs");
    while ($rows = mysql_fetch_array($records))
    {
        echo "<a href='".$rows['song_url']."'>".$rows['song_title']."</a><br>";
    }
    
    ?>
</div>
<?php
include ("footer.html");
?>

Recommended Answers

All 3 Replies

You might creat a link like

echo "<a href='http://www.yoursite.com/playsong.php?songid=".$rows['song_id']."'>" .$rows['song_name'].'</a>';

then in playsong.php
query your db again for the url

if (isset($_GET['songid'] )
     {
     $songid=mysql_real_escape_string($_GET['songid']);
     $query="SELECT song_url FROM songs WHERE song_id=$songid";
     ...

I sugest you youse the PRIMERY_KEY of your table
and do an other query in audio_play.php

if you gona use the mp3-url atleast take look at urlencode

You have to edit audio_play.php
the url of the mp3 will be in $_GET

$mp3=urldecode($_GET['songid']);
?>
<audio ><source src="<?php echo $mp3; ?>" type="audio/mp3" /></audio>"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.