$_get

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dsjoes
Forum Commoner
Posts: 41
Joined: Thu May 20, 2010 3:15 pm

$_get

Post by dsjoes »

can someone tell me how to get the download part of this to work
the $file gets the correct information for the embed part but it dosn't work for anything after that is ther something i need to do to get it to display after

Code: Select all

<?php  
$file = $_GET["listen"];
echo "<embed src=\"../audio/audio_files/$file\" autostart=\"false\" loop=\"false\" height=\"45\" width=\"170\"></embed>";
echo '<br/>';
echo '<a href=/audio/audio_files/$file target="_blank">Download</a> (Right click and save target as)';
?>
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: $_get

Post by danwguy »

Your link doesn't have the correct sytax from what Ican see. I would use something like this...

Code: Select all

echo "<embed src=\"../audio/audio_files/".$file."\" autostart=\"false\" loop=\"false\" height=\"45\" width=\"170\"></embed>";
echo '<br/>';
echo "<a href=/audio/audio_files/".$file."\" target="_blank">Download</a> (Right click and save target as)";

Could be wrong but I'm pretty sure that is the proper syntax for calling a href with a variable. I've used that exact syntax to show a file using a php script before.
dsjoes
Forum Commoner
Posts: 41
Joined: Thu May 20, 2010 3:15 pm

Re: $_get

Post by dsjoes »

i now get this message here
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

Code: Select all

echo "<a href=/audio/audio_files/".$file."\" target="_blank">Download</a> (Right click and save target as)";
fixed it thanks
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: $_get

Post by danwguy »

Sorry I forgot to add one part to that...

Code: Select all

echo "<a href=/audio/audio_files/".$file."\" target='_blank'>Download</a> (Right click and save target as)";
putting single quotes around the _blank in target. Did that work?
Post Reply